Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Programmers Question: Hashing and Alpha/Beta bounds

Author: Dieter Buerssner

Date: 09:38:56 06/07/05

Go up one level in this thread


On June 06, 2005 at 18:52:13, Johannes wrote:

>Thanks for the quick responses!
>
>I've already tried some of your suggestions and it works fine.
>Another question that I have:
>What about Mating scores? If i get a mating score from the TT there is also no
>need to continue the search (other than improving the "mating distance"), right?

Correct (but be aware of subtle bugs - see below)

>if (tt_flag == VALID && (tt_merit > -MATE_THRESHOLD || tt_merit <
>MATE_THRESHOLD)) return tt_merit;

Above, you lose the ability to find shortest mates. The bound tests are not
critical.

>if (tt_flag == LBOUND && tt_merit > -MATE_THRESHOLD) return tt_merit;
>if (tt_flag == UBOUND && tt_merit < MATE_THRESHOLD) return tt_merit;

Seems you got the sign wrong for MATE_THRESHOLD (or you defined UBOUND and
LBOUND wrong).

An engine, that does not have the ability to find the shortest mate may easily
announce mate in 5 (for example) forever. After every move of the opponent, a
move with mate in 5 is found directly from the hash. It has happened to my
engine, even when I did not use above mentioned cutoffs. Just stopping the
search when the first mate score is found, can be enough. Above cutoffs may make
the problem even more severe, so that searching further will not help.

But you can do easily better. When a mate score is good for a cutoff, you can
always use it - even when the stored depth in the HT is *not* enough. Example,
window at (0,50), remaining depth 8. In HT you have stored a lower bound of mate
in 3 with depth ("draft") 3. Just cutoff, ignore the normally too low draft for
cutoff. When window is 0, +inf, remaining depth is 5, and you have an exact HT
entry mate in 5 with depth 5 or higher, cutoff (this is just the normal exact
score cutoff). Here, when the depth of the stored value is only 4, don't cutoff
(but you might adjust alpha now).

This all will only work well, when you have a "clean" search without subtle
bugs/features (like some engines have, that can show too small mate).

When you are just implementing HTs, it might be better, to not use these ideas
first (also not the bounds adjustments discussed first), until everything is
well tested.

Regards,
Dieter



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.