Author: Gerd Isenberg
Date: 04:04:18 08/17/02
Go up one level in this thread
On August 16, 2002 at 23:26:08, James Swafford wrote:
>
>I'm in the process of tracking down some hashing problems, and
>I'm starting with my Zobrist keys. For each piece (i.e. bp, wp,
>wr, ...) I have 64 keys. I have 65 keys for "ep square", two
>for "player to move", 16 for castling rights. All keys are 64 bits.
>
>I just did a test to find the minimum hamming distance among
>all keys, and it was 14 bits. That seems a bit low.
>
>I think the way I'm doing 64 bit random number generation sucks.
>Here it is:
>
>Bitmap RandomBitmap(void)
>{
> Bitmap r1,r2;
>
> r1=Random32();
> r2=Random32();
>
> return ((r1<<32)|r2);
>}
>
>
>Ok, someone please confirm that this sucks and tell me a better
>way. :)
>
>I'm also interested in hearing what others are getting for min
>hamming distance between keys.
>
>--
>James
I also get a min hamming distance of 14 with this shift left 32. The average
hamming distance is 31. IMHO it's fine.
int getMinHammingDistance()
{
int minHammingDistance = 64;
for (int p=0; p < 14; ++p)
for (int s=0; s < 64; ++s)
{
for (int p1=p; p1 < 14; ++p1)
for (int s1=s+1; s1 < 64; ++s1)
{
int hammingDistance = PopCount(sHashvtbl[p][s] ^ sHashvtbl[p1][s1]);
if (hammingDistance < minHammingDistance)
minHammingDistance = hammingDistance;
}
}
return minHammingDistance;
}
Gerd
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.