Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Questions about hash table implementation?

Author: Gian-Carlo Pascutto

Date: 06:27:02 05/22/01

Go up one level in this thread


On May 22, 2001 at 08:03:51, Pham Minh Tri wrote:

>1) It is necessary to have both hash key and hash signature 64 bit? Could one
>of them be 32 bit?

Your hash key should be dependent on the table size. The signature should
be 64 bits.

>2) How to generate a 64 bit random number? (I use ran()*ran(). Is it OK?).

No. Use a 64-bit random number generator, or use a 32-bit one by
shifting and adding. Multiplication is not a good idea.

>3) Which set of random numbers is "bad" for chess? How to generate a "good" set
>of random numbers? Is it necessary to filter (prune) some "bad" numbers?

You might want to check the Hamming distance of the numbers (assuming
you use a Zobrist scheme). The hamming distance is the number of different
bits,

>4) To start, I usually use the command srand((unsigned)time(NULL)) - is it good
>or dangerous? Should I use a "good" const?

Use a constant. Your searches will become reproducible, which helps a
ton during debugging.

>6) I use the operation addition for making new hash key. Certainly, it is
>lower than XOR, but anything else? (I heard one time about it, but forgot).

I think adding sets some cpu flags, whereas XOR does not. This might
make it harder for the compiler to optimize.

>7) How to measure the "collision" (I little confuse about the dividend)? And
>other measurements?

You can do it, for example, by checking whether the move that is in the
hash entry that matches is possible in the current position. If it is not,
hash entries were equal for different positions and you have a collision.

--
GCP



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.