Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Principal variation search question.

Author: Kevin K

Date: 02:15:28 05/10/05

Go up one level in this thread


On May 10, 2005 at 04:36:30, Renze Steenhuisen wrote:

>What kind of sick yoke is this? It is the same code...
>
>The second code even contains the line "fFoundPv = TRUE;" A variable that isn't
>even declared!
>
>Well... If you really didn't see, and you asked seriously:
>
>fFoundPv is TRUE when "this is the first move"
>
>Cheers
>
>Renze

It was typo.
I mean:

int AlphaBeta(int depth, int alpha, int beta)
{
    if (depth == 0)
        return Evaluate();
    GenerateLegalMoves();
    while (MovesLeft()) {
        MakeNextMove();
        if (this is the first move)
            val = -AlphaBeta(depth - 1, -beta, -alpha);
        else {
            val = -AlphaBeta(depth - 1, -alpha - 1, -alpha);
            if ((val > alpha) && (val < beta)) // Check for failure.
                val = -AlphaBeta(depth - 1, -beta, -alpha);
        }
        UnmakeMove();
        if (val >= beta)
            return beta;
        if (val > alpha)
            alpha = val;
    }
    return alpha;
}



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.