Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Hash in Crafty

Author: Brian Richardson

Date: 15:28:43 05/31/00

Go up one level in this thread


On May 31, 2000 at 17:45:27, Bas Hamstra wrote:

>What is the philosophy behind Crafty's hashcode? I see a couple of things that
>make me wonder:
>
>- Black hashvalue is NOT-ted
>- 2 separate hashtables, one depth-preferred, one always-replace
>
>Is this fundamentally better than my method:
>
>- Table[Size][BucketSize] where BucketSize = 8
>- With a "store" simply replace the worst depth of the 8 entries (is there is
>none empty) regardless of movecolor
>- A bit in the hashrecord indicates movecolor
>
>Note that a "retrieve" has to read 8 hashrecords worst case. It doesn't seem to
>slow me down much. I don't store D=0 nodes or qnodes.
>
>Comments are appreciated.
>
>
>Regards,
>Bas.

Allow me to comment on Crafty (subject to correction/amplification by Bob Hyatt,
of course).  I have looked at Crafty's hash code quite a bit.

The NOT for black skips the need for separate black/white hash tables or the
need to double XOR the side to move (once to back out the old side and once
again to update the new side), since the side to move is a part of the
"position" (along with castle rights and enpassant).

The two level table is to help in situations where Crafty makes a move and then
starts pondering for a LONG time and gets deep (storing positions in the hash
table).  When the opponent finally moves if the predicted move is not made, then
the hash table may have many entries with high draft values that are slow to be
replaced with the current search (until it gets as deep as the prior pondering,
if ever).  There are also some ICCA articles about 2 level tables, but they seem
to have greatly diminished benefits at 1M entries and beyond.

I have tried both in Tinker and the single level table has always been between
5%-10% faster than 2 levels.  The hash "id" also does not seem to help much for
Tinker.  Main memory and caches may be much better now than even a few years
ago.  I do "age" hash drafts after Tinker's move and again after the opponent's
move, but only if the predicted move was not made (and the search time is over a
minimum limit).

Brian Richardson



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.