Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Subtle Hash Table Bug -- Help for others

Author: Bruce Moreland

Date: 10:25:31 03/30/99

Go up one level in this thread



On March 30, 1999 at 12:44:47, Tim Mirabile wrote:

>On March 30, 1999 at 12:14:51, Bruce Moreland wrote:
>
>>So if you find a mate in 3 at a given node, and you are 9 plies from the root,
>>normally you score this as mate in 12, but this has the bugs you discovered.
>>
>>What you'd do instead is subtract the "9" from the score and store mate in 3 in
>>the table, and when you look it up later, and let's say you happen to be 2 plies
>>from the root, so you add this in to get mate in 5.
>
>This makes sense to me.  The evaluation is mate in three regardless of how it is
>reached.  When backing mate scores up the tree it makes sense to add a ply for
>each one you go up.

You have to, but how you'd do it typically is add the depth fudge in when you
score the posiition, it's not like you're constantly changing the position's
value as you go back up.

Let's say you encounter a position, do a search, and discover that this position
is a mate in 9.  Mate in 9 is a number.  If mate in 1 is 30000, mate in 2 would
be 29999, mate in 3 would be 29998, ... mate in 9 would be 29992.

Ok, so let's say you execute the move, your opponent makes the strongest reply,
and there you are searching again.

You reach the exact same endpoint, meaning the move where your opponent is
mated, but this time the score needs to be mate in 7, which in my example above
would be 29994.

So you have an endpoint whose score needs to be backed up to the root, just like
it was a moment ago, but the value of the endpoint needs to be 2 centipawns
larger than it was before.

Likewise there are a lot of supporting nodes, whose values are presumably in the
hash table, that need to have this built-in adjustment as well, including those
hash table values that are actually bounds (you might have entries whose score
is something like ">= mate in 5").  Personally I don't even want to think about
what to do with scores like that, so I just cut all of this out by storing mates
as bounds.

The whole problem here is that a mate is a mate is a mate, but in order that
programs don't sit around choosing mates in 12 when mates in 1 exist, path
information is taken into account, and alpha-beta with transposition tables is
really bad at that.  These problems exist in other cases, but in this case you
tend to notice, because you expect the thing to say mate in 7, 6, 5, 4, 3, 2, 1,
game over, and if it doesn't you are apt to try to go figure out why, and you
end up cursing at your hash table.

You want to see a fiasco, try hooking up distance-to-mate tables to a chess
program.  You'll encounter hash table bugs *really* often then.

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.