Computer Chess Club Archives


Search

Terms

Messages

Subject: questions about hash.c of Crafty

Author: Uri Blass

Date: 14:54:00 12/13/03


I think about rewriting my search code and before doing it may be a good idea if
I understand somethings about the search of Crafty.

One of the relevant files is hash.c and I think that better comments about it
are important for progress in computer chess.

I plan to try to understand it and to give also comments.

for now I have some questions.

1)I see that the functions get parameters that I have as global varaibles

int ply, int wtm

Is there an advantage from not having them as global varaibles?

I thought that asking a function to get a lot of parameters may make the program
slower so varaibles that I need in many functions like side to move are global
varaibles.

2)I see
temp_hashkey=(wtm) ? HashKey : ~HashKey;

My question is where exactly the program remember the hash key of previous
positions? (I guess that it needs it to detect repetitions)

It is possible that I do not understand the code but
it seems to me that here it does not read the hash key from an array like I do
because it has

#define HashKey               (tree->pos.hash_key)

I can comment that the ~ that is used in Crafty may be better than what I do


I do every time that the side to move is changed

BitBoard zob=zobkey[hply]^zobrist[0][0][0];

I think that it may be better and slightly faster to have
BitBoard zob=~zobkey[hply];

3)What is the depth that is stored in
HashStorePV?

storing depth 0 is logical because I guess that the pv should not be pruned
based on hash tables and you can expect depth 0 to be replaced later but I do
not see comments about the depth that is stored.

If I understand correctly the depth is stored in draft that is 15 bits and depth
1/60 means 2^17 when depth (2^15-1)/60 that is the maximal theoretical depth
that can be stored means 2^32-2^17.

Even if I understand correctly(I am not sure)
I do not understand at this moment from all the varaibles what is the depth that
is stored in the hash tables in HashStorePV.

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.