Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: keeping track of PV and using hashed results

Author: Robert Hyatt

Date: 08:16:31 01/16/99

Go up one level in this thread


On January 15, 1999 at 14:21:16, GBes wrote:

>Hi all,
>
>a month ago i start writing a chessprogram.
>The part of the program that generates moves ( with bitboards )
>works fine, also the hashtable seems to work.
>
>The evaluation function returns simply (-MATE + ply) or 0;
>
>For the alpha/beta search i have trouble with keeping track
>of the principal variation.
>
>After doing a HashProbe that returns EXACT, i have a BestMove and its Score
>from the hashtable.
>What i don't have is the sequence of moves that comes after this BestMove.
>This okay if BestMove is not part of the PV after all (IMHO)
>but if it is then i only have a first part of the PV, and i want more...


you have two choices: Either cut the PV 'short' at this point, or call a
function that makes _all of the moves at the current (no move) ply and do
a hash probe after each.  If you get a hit with a best move, add it to your
PV, make that move, and repeat.  You can often recover quite a few more moves
this way.



>
>so my question is :
>
>"How to keep track of the principal variation when using results from the
>hashtable ?"
>
>Hope someone can shine some light over this
>
>thanks a lot gerritbes.
>
>
>this is how i am doing it now :
>
>int ABSearch( alpha, beta, depth, ply )
>{
>   if ( depth == 0 ) return Evaluate();
>
>   switch ( HashProbe( hashKey, depth, ply, *lHashScore, *lHashMove ) )
>   {
>      case EXACT:
>                 if ( alpha < lHashScore < beta )
>                 {
>                   // could return lHashScore here
>                   // but then don't have the PV ?????
>                   // so... continue
>                 }
>                 else
>                 {
>                   return lHashScore;
>                 }
>      break;
>   }
>
>   while ( lMoreMove )
>   {
>      // calls to ABSearch...
>   }
>
>   // update PV if a move was found in while loop
>   if ( initial_alpha < alpha < beta )
>   {
>     PV_Moves[ply][0] = lBestMove_found_in_while_loop;
>     PV_Moves[ply][1...] = PV_Moves[ply+1][0...];
>     PV_Moves[ply+1].Empty();
>
>     // also store here this position with type = EXACT in hashtable
>
>   }
>   else
>   {
>     // PV_Moves[ply] is empty
>     // or contains MoveSequence that leads to score alpha (IMHO)
>   }
>
>   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.