Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Repeated Positions

Author: Bruce Moreland

Date: 21:48:00 08/05/99

Go up one level in this thread



On August 05, 1999 at 22:51:41, Scott Gasch wrote:

>Both Bob and Bruce mentioned a small hash table specifically for detecting
>repetition.  I guess this would be implemented as an array of counts indexed by
>a subset of the position's hash key -- say the last n bits.  What is to prevent
>false draw reading, however, if two (different) positions in the same search
>yield the same key subset (and artificially inflate the count).

In the hash element you store the whole hash key.  So the odds of a bad draw
score on any given node are the same as the odds of a full 64-bit hash
collision.

>Related question: I am initializing my transposition hash square-piece array
>with just random numbers (rand()).  This is not good for many reasons: 1) if the
>random numbers I get (seeded off system clock) are bad (not very random) hashing
>performs badly and we have many collisions (I have not really seen this happen
>but in theory I guess it could).  2) there is no way I can predict what a key
>for a given position will be beforehand which is okay now but when I write an
>opening book I'd like to be able to do this.  So definately I need some kind of
>function to generate the seeds.

Use the "srand" function to seed the random number generator with a known
constant value, then seed it based upon the system clock when you are done, so
that you get real random numbers after that.

Alternately, you can write a program that will write some C that initializes the
data, then just run this once and include the produced file in your souce.

>My (next) question is this -- what do you guys do for said function?  I am
>computing two numbers for each position - a key and a checksum.  The key is just
>xors of seeds for piece/square and the checksum is adding and subtracting seeds.
>I had considered using prime numbers for the seeds but I don't see how that
>really will help produce a uniform hash distribution.

I just use rand().  I don't think it matters what number you use for the seed to
rand().

bruce



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.