Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Fast hash algorithm

Author: John Scalo

Date: 17:04:22 01/08/98

Go up one level in this thread


On January 08, 1998 at 19:51:44, Robert Hyatt wrote:

>On January 08, 1998 at 17:57:13, John Scalo wrote:
>
>>Reviewing the bottlenecks in my program, I realize that my hash key
>>algorithm is fairly inefficient. It uses the Zobrist algorithm for
>>creating keys from relatively large structures like an [8][8] array, but
>>it's too slow.
>>
>>I would think that having bitboards of white's and black's pieces would
>>be sufficient to come up with a 32-bit key quickly, but I haven't been
>>able to come up with anything that gives a "random" enough distribution.
>>
>>Any ideas? I looked at Crafty but couldn't figure out exactly what it
>>was doing.
>>
>>Thanks,
>
>
>the main "key" is to compute the hash key incrementally as you make and
>unmake moves, rather than looping over the entire board to construct the
>thing before you do a probe.  The nice thing about the "exclusive-or"
>operation is that if you exclusive-or the same value with the hash key
>a second time, it undoes the first exclusive-or... so you can easily
>update
>the hash key as you move pieces around...

Ah.. That explains why you attach the key to the search global in
Crafty. What values/structures do you use to update the key after a
move? The move itself or the new bitboard(s) ?

Thanks,
John



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.