Computer Chess Club Archives




Subject: Re: Hamming distance code

Author: Larry Griffiths

Date: 13:51:51 02/25/99

Go up one level in this thread

On February 25, 1999 at 15:16:45, Don Dailey wrote:

>Ok, I took a few minutes to look at the problem and it was in
>my hamming distance function.  I was counting the number of
>bits in common, so really my distance function was a closeness
>function!   So the bug was in my code.  It was also the very
>first thing I looked at, since I had a hunch.
>I ran your code with my random number generator and it now
>we completely match if I turn off your optimization of taking
>the compliment of good numbers.   That optimization is pretty
>effective and makes it find numbers much more quickly.
>It looks like 32 bits is pretty tough to achieve, probably
>not even feasible.  Any idea how to compute the maximum distance
>possible in a given size table of 64 bit numbers?
>- Don
>On February 25, 1999 at 14:15:01, Don Dailey wrote:
>>On February 25, 1999 at 08:23:55, Robert Hyatt wrote:
>>>On February 25, 1999 at 00:40:47, Don Dailey wrote:

Here is a version of my code that I used to set half of the bits on
in my piece table.  My program ran within 10% timewise using this
code verses random numbers. (The random numbers seemed to work better.)

	unsigned long onebit=0x00000001;
	for(int w=1;w<=bitwidth;w++)
		int	setoncount=384;   // Half the entries in the piecesqtbl
			int p=random(12);
			int sq=random(64);

Larry   :-)

This page took 0.02 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.