Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Question about hash tables

Author: Robert Hyatt

Date: 04:47:56 10/19/99

Go up one level in this thread


On October 19, 1999 at 05:51:22, José Carlos wrote:

>I use the standard hash function generated from a set of 64bit random numbers. I
>use the n rightmost bits of the 64bit code as index (of the array), n depending
>on the hash table size.
>I think this is normal, but my question is related to the checksum to ensure the
>position in the table is equal to that in the board.
>The only way to ensure this is to code the board (256bits if 4bits per square
>and piece or about 180 if using huffman code). I use the first.
>But last night I was looking at Crafty's code (16.15, if I remember right), and
>saw it uses a 64 bit checksum. That's what I read in the comment before the
>HashProbe function, but I could not find where is this checksum generated, and
>how.

it is simply the 64 bit hash signature...  I use the rightmost N bits as the
probe address, and store the entire 64 bit signature as the 'checksum' as you
call it...




>My question is: with, at most, 128bits per position (that I'll never would use
>in fact), isn't it possible to make mistakes? I know the probability is small,
>but eventually there could be a very strange move coming from a hash table
>mistake. Is this true? What am I missing?

mistakes are possible.  But they are _very_ improbable using 64 bits.  The
way to confirm this is to have a debug mode where you do store the simple 256
bit actual board position.  When you get a match on the 64 bit value, then
check the full 256 bit value.  If it doesn't match, you have a false match.  I
ran such a test for many hours and got zero.



>Is, anyway, safe to use a 64bit checksum? And if so, is the checksum generated
>the same way as the hash code, but with different random numbers?


no.. the 'checksum' _is_ the 64 bit hash code.


>
>Thanks in advance.
>
>José C.



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.