Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Crafty opening book question

Author: Robert Hyatt

Date: 20:37:02 10/01/01

Go up one level in this thread


On October 01, 2001 at 17:46:57, Alvaro Jose Povoa Cardoso wrote:

>On October 01, 2001 at 17:36:26, Robert Hyatt wrote:
>
>>On October 01, 2001 at 16:55:21, Alvaro Jose Povoa Cardoso wrote:
>>
>>>I know this question was probably made many times, but I wasn't listening :)
>>>Could someone please explain in detail the Crafty openings book binary format?
>>>Does it represent positions and not moves?
>>>
>>>Best regards,
>>>Alvaro Cardoso
>>
>>
>>Yes.  It is essentially hash signatures produced by making moves and then
>>updating the hash signature after each move and storing it.
>>
>>It uses a cute "grouping" scheme so that all the signatures that share a
>>common "parent" position are lumped together in the book file so that one I/O
>>operation will read in all possible book moves for any position.
>
>Could you please explain this grouping scheme?
>




Sure.  I take the upper 16 bits of the parent position hash signature, and
combine that with the lower 48 bits of the "children" signatures.  I sort
the file into ascending sequence, so that all positions with the same 16 bit
parent signature part are grouped together.  That gets all children of the
same parent into consecutive file positions. I then build a set of indices
that point to each of these "clusters".  (A cluster is all book positions that
match in the upper 16 bits).  I have a pointer to each cluster, and the first
thing in a cluster is the number of bytes in that cluster.  I read the first
4 bytes the index points to to get the number of bytes in the cluster, then
I read in the entire cluster.  I search it sequentially for each hash signature
match after trying a legal move.

Simple and effective.




>Also, did you ever noticed any anomalies by using the hash signatures scheme
>due the non existing 'one to one relation' bettween positions and hash
>signatures? In other words, could a program make a wrong opening move because of
>hashing inconsistencies/limitations?
>
>Thank you,
>Alvaro Cardoso


It has never happened to me.  I have heard others fight with this problem,
but it was never clear (to me) whether it was a hash signature collision or
whether it was some other sort of bug...



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.