Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Searching a book for a move: How does Crafty do it?

Author: Robert Hyatt

Date: 07:46:18 03/26/05

Go up one level in this thread


On March 26, 2005 at 10:29:23, Anson T J wrote:

>How does Crafty grab a book move so quickly? Are there any experts who
>understand how the positions are represented inside the book file and the
>algorithm works to zero in on a book move so quickly?


crafty uses the high-order 16 bits of the hash signature as a "cluster number".
On the front of the book.bin file, I have 32768 pointers (actually just byte
offsets into the file) that point to the start of each of these "clusters" where
the position _after_ the move is made is guaranteed to exist, if it exists at
all.

How do I guarantee that?  Easy, for each 64 bit hash signature in the book, the
leftmost 16 bits (the cluster index) comes from the position _before_ a move is
made, the rightmost 48 bits comes from the position _after_ the book move is
made.  This way all possible book moves from the same parent position will be in
the same cluster, which means one disk read and I have all potential resulting
positions after any known book move is made.  Of course a cluster has book moves
from several different parent positions since the most significant 16 bits is
not unique for each parent position.  But this way, I do just one I/O which
makes it fast...




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.