Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Hash Collision

Author: Sune Fischer

Date: 04:13:51 12/08/02

Go up one level in this thread


On December 08, 2002 at 06:00:24, David Rasmussen wrote:

>On December 07, 2002 at 13:54:56, Sune Fischer wrote:
>
>>
>>Well it's still a good idea to do the test, because you detect a small portion
>>when only validating the hash move. Anyway it shouldn't be more than a few lines
>>inserted into the hash probe.
>>
>>#define ChopOff(x) (x&0xffffffffffff0000) // ie try with 48 bits
>>
>>if (current_key!=draft_key)
>>  if (ChopOff(current_key)==ChopOff(draft_key))
>>     Collisions++;
>>
>>
>
>First of all, it should be
>
>#define ChopOff(x) ((x)&0xffffffffffff0000) // ie try with 48 bits
>
>Not using parenthesis on all levels in preprocessor macros, will get you into
>trouble sooner og later.

Yes, you are right, my macros all have the parenthesis' around non constants

> Of course, I would never use the preprocessor if I
>could avoid it (and I almost always can). In this case, since I am using C++, I
>would make a typesafe inline function instead (which is one of the many many
>reasons I am using C++ instead of C).

Right again, I am currently getting rid of most of my macros and doing things
the inlined way. I am considering doing this to the "MOVE" also, but dang it is
a big rewrite.

>That aside, what do you hope to accomplish by such code? You count how many
>times the upper 48 bits of a 64 bit signature are the same for different
>signatures. That's not interesting.

This is precisely what is interesting, because it would tell you how often a 48
bit key would have collided when a 64 bit won't.
Of course they might _both_ collide, but I think we agree that there is a very
small chance of a 64 bit collision, so you can use the 64 to validate the
correctness of the key.

>I use the whole signature for comparison in
>my hash entries so the upper 48 bits are not interesting to me. Such a count
>just shows how many collisions I _would_ have (at least) if I used 48 bit
>signatures instead of 64 bit signatures. I don't.

Actually the point is you don't need 64 bits, which the test will show you :)
I save 4 bytes per hash entry because I am willing to accept 1 collision every
10-50 games or something in that ballpark. I know the probability of this
causing a bad score and move is neglible compared to the win I get by having a
more dense hash. Considering the noise you always have on nullmove, razoring,
evaluation and what not, it becomes overkill to store the whole key, IMHO.

-S.
>/David



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.