Correcting Evaluation with the hash table

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

mjlef
Posts: 1494
Joined: Thu Mar 30, 2006 2:08 pm

Re: Correcting Evaluation with the hash table

Post by mjlef »

metax wrote:
diep wrote:Mind sharing rough pseudo code with us if you're not describing the usual hashtable cutoff?
If I have understood this correctly:

Code: Select all

int CorrectEvalScore(int eval, int ttValue, int ttBound)
{
   if (bound == LOWERBOUND)
   {
      return max(eval, ttValue);
   }
   if (bound == UPPERBOUND)
   {
      return min(eval, ttValue);
   }
   return eval;
}
And in search, after handling usual TT cut-offs etc.:

Code: Select all

// handle TT cut-offs
eval = CorrectEvalScore(Evaluate(), ttValue, ttBound);
Yep, that exactly. But make sure you check that the hash keys match. If there is no matching hash table entry then you skip the correction, of course.