Computer Chess Club Archives


Search

Terms

Messages

Subject: questions about crafty hash tables

Author: Uri Blass

Date: 15:12:09 12/19/03


I try to understand hash.c of Crafty so I see that HashProbe is called mainly
from search.c and
I see that it has
case EXACT:
if (alpha<beta) savePV(tree,ply,alpha,1);
return alpha;

some questions
1)what is the job of the third parameter in savePV

the definition in chess.h is

#define SavePV(tree,ply,value,ph) do {                                      \
          tree->pv[ply-1].path[ply-1]=tree->current_move[ply-1];            \
          tree->pv[ply-1].pathl=ply-1;                                      \
          tree->pv[ply-1].pathh=ph;                                         \
          tree->pv[ply-1].pathd=iteration_depth;} while(0)

value is not used in savePV.

2)In the comments to search.c I see

"1. HashProbe() returned "EXACT" if this score is greater than beta, return
beta."

The problem is that later I see only return alpha in search.c

case EXACT:
      if(alpha < beta) SavePV(tree,ply,alpha,1);
      return(alpha);

I understand that HashProbe already changes alpha but the question is if it
changes it to be beta in case that the score is greater than beta.

I guess that the answer is dependent on a part of hash.c that I need to
understand and I am talking about calculating type and val in the following part
of hashprobe and the question is if val can get value that is bigger than beta
when type get EXACT.

htable=trans_ref+((int) temp_hashkey&hash_mask);
  word1=htable->prefer.word1;
  word2=word1^htable->prefer.word2;
  if (word2 == temp_hashkey) do {
#if !defined(FAST)
    local_hits++;
#endif
    word1l=word1>>32;
    word1r=word1;
    val=(word1r & 0377777)-65536;
    draft=word1r>>17;
    tree->hash_move[ply]=word1l & 07777777;
    *threat=(word1l>>26) & 01;
    type=(word1l>>27) & 03;
    if ((type & UPPER) &&
        depth-null_depth <= draft &&
        val < *beta) avoid_null=AVOID_NULL_MOVE;
    if (depth > draft) break;
    if (abs(val) > MATE-300) {
      if (val > 0) val-=(ply-1);
      else val+=(ply-1);
    }


Uri



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.