Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Another funky hash problem

Author: Bruce Moreland

Date: 11:07:34 08/25/99

Go up one level in this thread



On August 25, 1999 at 03:27:11, James Robertson wrote:

>On August 25, 1999 at 01:29:55, Bruce Moreland wrote:
>
>>
>>On August 24, 1999 at 22:02:33, James Robertson wrote:
>>
>>>I was looking at my code and noticed that I never get any cutoffs when there is
>>>no available hash move.
>>
>>I don't understand this.
>>
>>> I modifed my code a little, and it sped up, but then I
>>>noticed tactical problems;
>>
>>Are you fixing bugs or trying to make it go faster?  If you were trying to fix
>>something, why are you checking speed?
>
>Trying to make it go faster, and noticed when I did something that seemed to be
>logical, it caused problems.
>
>>
>>>on a certain test position it never finds a fairly
>>>obvious move. Anyway, here is my hash code in my search function.
>>
>>You aren't sounding like someone who is in control of your code.  No offense,
>>but what makes you think that anything is wrong with the hash stuff?  What did
>>you do that made it faster and why do you think this may have destabilized it?
>
>Of course I'm in control of my code. Every bit of it that doesn't have the words
>'hash' and 'alpha' or 'beta' in it. :\ The reason I have this haunting feeling
>that anything that goes wrong in my program must be the hashing code is that it
>is the only part I do not fully understand.
>
>Also, I had the feeling that my changes destabilized it when it missed a simple
>tactic in a certain position. I suppose there are 3 possibilities as to what
>would cause the problem; a) a freak hash collision, b) a problem with the hash
>stuff in my search function, or c) a problem elsewhere. I decided not to think
>about a) (do you check for hash collisions, btw?), take b) here for you guys to
>look at, and worry about c) later.

I have never tried to figure out the hash collision rate, I should do this.

I have never found a bug that I was able to attribute to a freak hash collision,
and every time I've heard someone else say they've found one, it's always that
they had something weird happen and attributed it to a freak hash collision.

I ignore the possibility and this has worked well so far.

Which is not to say that I'll crash if I get one.  If there is something out of
place in my hash element, I have things set up so that it can't cause an illegal
move to be made on the chess board or entered into the PV or something like
that.

Hash table stuff is hard to debug in the first place, and causes awful behavior
even when it is debugged.

You can't cure every case of awful behavior, this is just going to happen.
You'll get fail-high fail-lows due to search value changes due to path-dependent
scoring and pruning dependent upon alpha (including null-move pruning).

You can have bugs that look like this though, which aren't due to these
problems.  You can mess up calculation of your hash key, you can store bogus
stuff in the element, and you can do the wrong stuff when you are trying to
prune based upon what is in the element.  You just have to be extremely careful
about all of this, try to write code that will catch bugs if you are getting
them, and aggressively pursue the bugs that do manifest, even though it is hard
to do this.

Your code looked fine, to the extent that I understand what you were trying to
do, but that mate score adjustment stuff is just unnecessary complication and a
source of more bugs IMHO.

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.