Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: how do I determine 'mate in' depth?

Author: Dave Gomboc

Date: 00:40:58 09/10/02

Go up one level in this thread


On September 09, 2002 at 11:30:01, scott farrell wrote:

>This may seem obvious, but my chompster is only a todler.
>
>I have tried adding it to the score, like:
>INFINITY+12  (for mate in six), this does a few bizare things,
>like the first move played shows a score of INFINITY+1, the second move
>INFINITY+3 (which is obviously from the hastable), and then INFINITY+5 etc etc.
>
>Is it posible to read it from the hash table?
>
>I currently read my PV from the hashtable.
>
>Thanks
>Scott

Tips (roughly from simple to advanced):

1.

a) oo (positive infinity) should indicate an evaluation of "my opponent is to
move but is checkmated".
b) -oo (negative infinity) should indicate an evaluation of "I am to move but am
checkmated"
c) ergo, subtract from oo or add to -oo when there is mate in 1, mate in 2, and
so on.  Don't use values higher than oo or lower than -oo.  That way, the
shortest checkmates of your opponent are the best scores, and the shortest
checkmates of you are the worst scores.

2.

a) you have to adjust mating scores before you store them in the hash table to
account for the difference between how many moves ahead you're looking.
b) you also have to make the reverse adjustment when you get mating scores out
of the hash table.
c) define a "mating margin" and use it to tell whether you need these
adjustments to be made.  For instance, crafty uses MATE-300.  Note that that
value will have to change when he gets a tablebase that has a mate in more than
300 moves.  I recommend you #define MATE_MARGIN 300 (or use a const declaration)
so that you can update it in one place instead of many times (and possibly miss
one by accident.)  Anyway, make sure that your MATE_MARGIN is big enough to
handle all forced mates you can find (pretty big if you use endgame tablebases),
but small enough that no scores from your normal position evaluator ever creep
into it (so don't use MATE-25000, because you'll end up thinking that a position
you're up a few queens in is an actual checkmate, when it isn't.)

3) when you're searching from a normal position, you don't actually need to know
the exact length of the mate: any mate is probably going to force a cutoff.
Resolve the exact mate score only if you fail high with beta = MATE-MATE_MARGIN
or fail low with alpha = -MATE+MATE_MARGIN.  That will mean you save time by not
bothering with making the mate score adjustment unless you actually need the
accuracy (once you're definitely checkmating your opponent).

Hope this helps.

Dave



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.