Computer Chess Club Archives




Subject: Re: Hamming distance code

Author: Don Dailey

Date: 12:16:45 02/25/99

Go up one level in this thread

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:
>>>I'm still concerned that our numbers are so far off.  Unfortunately
>>>I haven't had much time to go over it again (too busy on this darn
>>>board)  I don't see any bugs in my hamming code.  Any ideas?
>>>- Don
>>Yes.. you are overlooking one important detail:  these are 'random numbers'
>>of course.  I use the generator from Knuth's book (also in Numerical Recipes)
>>to generate 32 bit random numbers and then piece two of them together to make
>>a 64 bit value.  It might be my RNG is not doing so well with respect to yours.
>>What RNG are you using?
>But I'm getting good hamming distances much quicker than you.  If it's
>a RNG problem then my generator is the better one.   We should check this
>out but I'm guessing that I might have a bug in my hamming code, or
>possibly you do.   I'm going to carefully inspect the code you posted
>and test my numbers with your code to see what happens (as soon as I can
>get a chance to.)
>I am using the RNG that comes with Linux,  or actually GCC.  But to
>get 64 bit numbers I have kludged something like you have but I
>construct them 8 bits at a time (very slow.)   I grab some bits in
>the middle of 8 different random numbers and piece them together
>to get a single 64 bit number.   I could do something much more
>efficent with just 2 passes, but the code is highly platform
>independent and I wanted this code to be compatible with lousy
>15 bit random number generators.
>I'll figure it out as soon as I can get a free 30 minutes or so
>to test both our code.   It is very possible that my code is
>broken since I hacked it together in 5 minutes and didn't test
>it very thoroughly yet.   If it is broken I'll post you a message.
>- Don

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.