Computer Chess Club Archives


Search

Terms

Messages

Subject: Storing mates in the hash table

Author: Alessandro Scotti

Date: 15:37:26 09/03/04


A while ago, my engine played this little gem with Black:

1. f3 e5 2. Nc3 Nc6 3. b3 Bc5 4. Ne4 Be7 5. Nc5 Bxc5 6. g4 Bxg1

With its last move, it missed a mate in one... now that's a bug! :-) However, it
turned out things were a little more complicated. Actually the engine found the
mate, however it wasn't stored in the hash table because the move Bxg1 was
explored more deeply... of course, it only takes one ply to detect an immediate
checkmate! So the search returned a mate score, but when the PV was fetched from
the hash table the move Bxg1 was found instead.
Of the many solutions I could find to this problem, eventually I picked one that
seemed quite promising, that is: a mate score, regardless of the depth it is
found, is more valuable than a non-mate and should always be stored in the hash
table. The way I do this is simple: mate scores are assigned a "virtual depth"
of say 10000 minus the distance to the mate in plies. This allows mates to
replace any other moves (for a common deeper is better hash policy) and faster
mates to replace even other mates.
When I implemented this one-line feature, it worked miracles and my engine would
quickly find many mates that were out of reach before. Now that I have fixed a
few bugs, the effect is not so easy to quantify, and I don't have a gain in each
and every position.
Especially, this seems to interact a lot with null move searches. In WAC141,
with my standard null-move policy I got a tremendous reduction in nodes, maybe
30-40% IIRC. If I use a slightly more aggressive policy, results are entirely
different and I got a noticeable slowdown, although not in the same order as the
above.
For the effort it takes to implement (maybe one minute), it could be worth
trying. BTW I'm using an MTD(f) search so a lot of stuff behaves very different
from PVS... your mileage may vary.
Any thoughs?



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.