Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bruce Moreland on collecting the principle variation. Is this correct?

Author: José Carlos

Date: 23:59:56 04/28/02

Go up one level in this thread


On April 28, 2002 at 21:19:20, Russell Reagan wrote:

>Here is the code in question. It's from his webpage "Collecting the Principle
>Variation" at http://www.seanet.com/~brucemo/topics/pv.htm
>
>typedef struct tagLINE {
>    int cmove;              // Number of moves in the line.
>    MOVE argmove[moveMAX];  // The line.
>}   LINE;
>int AlphaBeta(int depth, int alpha, int beta, LINE * pline)
>{
>    LINE line;
>    if (depth == 0) {
>        pline->cmove = 0;
>        return Evaluate();
>    }
>    GenerateLegalMoves();
>    while (MovesLeft()) {
>        MakeNextMove();
>        val = -AlphaBeta(depth - 1, -beta, -alpha, &line);
>        UnmakeMove();
>        if (val >= beta)
>            return beta;
>        if (val > alpha) {
>            alpha = val;
>            pline->argmove[0] = ThisMove();
>            memcpy(pline->argmove + 1, line.argmove,
>                line.cmove * sizeof(MOVE));
>            pline->cmove = line.cmove + 1;
>        }
>    }
>    return alpha;
>}
>
>My question is if this will always give you a principle variation. For one
>example, if you searched to a depth of 1 and the first move created a beta
>cutoff, you would return beta and the principle variation data would never be
>touched. I've never seen a chess program give a score with no principle
>variation. There's always at least one move in the principle variation, so am I
>missing something, or does this code not produce a principle variation in this
>case?
>
>Thanks,
>Russell

  If you want to do PVS or Aspiration Search or any other windowed search at the
root, you must handle the root moves differently, but if you do a plain
AlphaBeta with initial -inf,+inf window, the above code must work with no
problem, and give a PV always.

  José C.



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.