Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Where is Principal Variation?

Author: Robert Hyatt

Date: 10:51:38 11/22/00

Go up one level in this thread


On November 22, 2000 at 11:25:19, Severi Salminen wrote:

>Hi!
>
>There is something wrong in my chess program. I'm trying to search the PV moves
>first, then the captures and then non_captures. A question:
>
>Does a move belong to PV _allways_ when its score is >alpha and <beta? And can I
>use this assumption to find all PV moves by backing up from PV leaf to root?
>

By definition, yes.  But remember that there is an order dependency in this.
IE the most recent moves >alpha and < beta are the real PV moves, and could
replace PV moves found earlier in this iteration or search.




>My program has a separate root_search() and search(). In search I first check
>wheteher the last move was a PV move and then if we still have moves left in PV
>it swaps the first generated move and the PV move for that ply. Then we make
>moves (so the first is the PV move). And allways when I have alpha<score<beta I
>make the move we tried a PV move for that ply. For some unknown reason a certain
>position results a situation where my program tries to make a PV move which is
>not possible. The PV points to a move that is not in the move list of current
>ply.

Be careful.  It is possible to back up a value of "alpha" after searching every
move and finding that the successive ply fails high each time.  You now have
a score you are backing up, but you have _no_ PV to go along with it.  If your
test is wrong, you can break.  Same thing happens on a fail high.  You can back
up the current move as a best move for the 'fail-high PV', but you will have
_no_ moves below that node in the PV array.  It will probably contain old
moves that were not overwritten.  This will wreck you.



>
>// Here I test whether the last move was PV move and we have still PV moves
>// left
>
>if((Follow_PV[Ply-1]==1)&&(PV_lenght>Ply))
>  swap_moves(&Moves[Firstmove[Ply]],&Moves[PV[Ply]]);
>
>// Here I test if the move we made was a PV move
>makemove(Moves, k, ptr);
>if((k==Firstmove[Ply])&&(Follow_PV[Ply-1]==1)&&(PV_lenght>Ply))
>  Follow_PV[Ply]=1;
>else Follow_PV[Ply]=0;
>
>
>// This is done if beta>score>alpha
>// This basically avoids any problems because of the swapping we made
>if((Follow_PV[Ply-1]==1)&&(PV_lenght>Ply))
>   {
>      if(k==PV[Ply])
>         PV[Ply]=Firstmove[Ply];
>      else if(k!=Firstmove[Ply])
>         PV[Ply]=k;
>   }
>else
>   PV[Ply]=k;
>
>
>Any suggestions? (It was a bit unclear explanation, but...)
>
>Severi



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.