Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Question about hash tables

Author: Andrew Williams

Date: 04:39:22 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.
>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?
>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?
>
>Thanks in advance.
>
>José C.

I use the whole 64-bit hashkey for the checksum in PostModernist. 64 bits seems
pretty safe, but I also check the move coming from the table to make sure that
the piece on the from square can legally move to the to square etc etc. I'm sure
that this is overkill, but I tend to prefer to be overcautious with my program.
Producing another 64-bit hash key using different random numbers would be an
alternative way of being overcautious, but I'm pretty sure it would be a lot
slower.

Andrew



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.