Computer Chess Club Archives




Subject: Re: Hash Collisions (Dan)

Author: Larry Griffiths

Date: 05:18:34 02/24/99

Go up one level in this thread

On February 23, 1999 at 15:23:14, Dan Newman wrote:

>On February 23, 1999 at 14:43:29, Larry Griffiths wrote:
>>On February 23, 1999 at 14:33:03, Larry Griffiths wrote:
>>>I read your post on hash collisions.  I have tried some hamming distance
>>>code and I see little difference when compared to generating random
>>>numbers.  I have been thinking of writing code that does what you said
>>>where 64 bits must have 32 bits (or 50%) turned on in each number.  I also see
>>>where there are many references to the 12 pieces times 64 squares = 768
>>>hash codes.   Pawns only use 48 squares for each side, so 32 squares are unused by pawns.
>>Forget my reference to the Bishops.
>>>768-48 leaves 720 hashcodes for the piece square table.
>>>Food for thought?  Errors in my thinking?
>That's interesting.  You can generate a smaller set of random numbers and
>fill out only those portions of the table that are actually used.  And a
>smaller set can be better optimized in the same period of time. (Currently,
>IIRC, I use 1024 numbers for the piece-square part since I use Bob Hyatt's
>numbering scheme for pieces: P=1,N=2,K=3,B=5,R=6,Q=7 -- which is quite
>nice for distiguishing sliders from non-sliders.)


I actually only use a power of 2 for my hash keys.  If my hash table is
262144 entries, then I only use 18 bits for a hash key.  I currently store
a 64 bit bitboard in the hash entry for collision checking.  I did create
some code to choose numbers that have exactly 9 bits on with equal distances
between the numbers.  I ran 6 ply test using these keys but it did not seem
to make much difference.  I did try small number of bits and large number of
bits also.  I have a graph in my program to display the hash table usage.
I saw bands (16 of them) occur when using very few bits per number or
very many bits per number.  I think this is caused by the 16 pawn moves that
can be made on the very first ply but I am not sure of this.  I have "holes"
in my hash table that only get used after several moves by each side.


This page took 0.02 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.