Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Problems implementing hash tables

Author: Scott Gasch

Date: 11:50:31 02/09/02

Go up one level in this thread


On February 09, 2002 at 11:10:25, Steve Maughan wrote:

...
>I have implemented Bruce Moreland’s trick of storing the hash entry as a bound
>but this hasn't helped and I'm not sure why not.  My Hash storage routine is
>quite simple:

A few comments here after looking over your code.  First, another optimization
that is possible is to not store lower bounds near -NMATE or upper bounds near
+NMATE.  They say "this position worth at least ~-INFINITY" or "this position
worth at most ~+INFINITY" which is fairly useless.  You don't want to fill up
your hash with useless info.

Next you need to be creful when storing exact information about a position where
the score is mate in N.  The problem is you have mate in N from the node you
searched at.  But that node is ply from the root.  Later on you might have the
same position at a different distance from the root.  For example imagine you're
at ply 10 and find a forced mate in 5 in position X.  Well later on (either in
this search or another one) you might run into position X at ply 6.

You want the value of a checkmate to be related to the distance from the root
not "from here".  So when you store a mate in N, subtract the current distance
from root (ply).  You will be left with mate in (N - ply) or the distance to the
mate from the node.  When you hit an exact mate score add in the ply.  So you
will be hitting "distance to the mate from here" and then adding in "distance
from the root to here".  You'll end up with a mate score that is accurate and
represents "the distance from the root to the mate".

Also I looked at the searches you were running and it seemed like the engine was
losing the mate.  This might be due to a simple hash replacement scheme (or a
buggy replacement scheme) rather than a bug in the way you store mates.  Even
store useless bounds and don't adjust mate scores by ply (previous paragraphs)
you should still see the mate, just the distance to it will be unstable and
incorrect.  Also note you _can_ store a lower bound after a successful nullmove
cutoff.  I just store it with no hash move attached.

...
>
>This seems straightforward so where can I be going wrong?  Has anyone else come
>across this type of problem?

Hehe.  Someone called hashing straightforward... this is a sign of the
apocalypse for sure.  Good luck with your engine.

Scott



This page took 0.01 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.