Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Hash table and best move

Author: Mikael Bäckman

Date: 05:27:10 02/18/04

Go up one level in this thread


On February 18, 2004 at 02:55:48, milix wrote:

>Hi to everyone!
>In my amateur engine I encounter a really nasty
>hash table related bug. A hash element contained a
>position and a best move, say Ra8-a4. When this
>position occured again in a search, the rook was not
>on a8 but on a2. So the right best move should be
>Ra2-a4. So, I added a routine to check for such
>'corrupted' hash moves. I currently solve the above
>mentioned problem by looking at legal moves in the position
>that had a move with the best's move 'to' square and is moving
>the best's move piece. This correction is only done when I retrieve
>the PV from the hash table, so it is practically cheap.
>
>I have one question about the above concept:
>Is this happen to every hash table or I have a pathological
>situation which may (or may already have) introduce
>other bugs? My hash table uses the replace always scheme
>and is cleared only at the start of a new game.


Build a function which statically calculates the hashkey for a position. Then
compare that key with the incrementally generated key (normally you XOR the
changes to the hashkey at every makemove() call).

If the keys do not match, you have a problem with updating the hashkeys in
makemove().


/Mikael



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.