Difference between revisions of "Checkmate"

From Chessprogramming wiki
Jump to: navigation, search
(Created page with "'''Home * Chess * Checkmate''' border|right|thumb|[[Arts#Larratt|Shannon Larratt - Fool's mate (2007) <ref>Arts#Larratt|Shannon Lar...")
 
m
Line 16: Line 16:
  
 
==Down the Tree==  
 
==Down the Tree==  
Inside a [[Negamax|negamax]] based [[Search|search]], most <ref>[https://www.stmintz.com/ccc/index.php?id=469728 The Code for the Rybka-Mate-Bug] by [[Chrilly Donninger]], [[CCC]],  December 13, 2005</ref> programs assign ''VALUE_MATED + [[Ply|ply]] distance to the root'' as worst case score if entering a [[Node|node]], which if propagated as mate score along the [[Principal variation]] to the root, translates in mate in odd plies (positive values), or getting mated in even plies. However, those scores need ply-adjustment if stored as [[Exact Score|exact score]] inside the [[Transposition Table|transposition table]], and re-adjustment if retrieving from TT. An alternative approach, not only related to mate scores was proposed by [[Harm Geert Muller]], ''The Delay Penalty'' as implemented in [[Micro-Max]] <ref>[http://home.hccnet.nl/h.g.muller/delay.html Evaluation: Aging - The Delay Penalty] from [[Micro-Max]] by [[Harm Geert Muller]]</ref> <ref>[http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&p=147295&t=15129 Re: Transposition Tables] by [[Harm Geert Muller]], [[CCC]], September 26, 2007</ref> <ref>[http://www.talkchess.com/forum/viewtopic.php?t=16751 Delayed-loss-bonus discussion goes here] by [[Harm Geert Muller]], [[CCC]], September 28, 2007</ref> <ref>[http://www.talkchess.com/forum/viewtopic.php?t=31981 Seeing a promotion, but not playing it...] by [[Harm Geert Muller]], [[CCC]], January 24, 2010</ref>.
+
Inside a [[Negamax|negamax]] based [[Search|search]], most <ref>[https://www.stmintz.com/ccc/index.php?id=469728 The Code for the Rybka-Mate-Bug] by [[Chrilly Donninger]], [[CCC]],  December 13, 2005</ref> programs assign ''VALUE_MATED + [[Ply|ply]] distance to the root'' as worst case score if entering a [[Node|node]], which if propagated as mate score along the [[Principal Variation]] to the root, translates in mate in odd plies (positive values), or getting mated in even plies. However, those scores need ply-adjustment if stored as [[Exact Score|exact score]] inside the [[Transposition Table|transposition table]], and re-adjustment if retrieving from TT. An alternative approach, not only related to mate scores was proposed by [[Harm Geert Muller]], ''The Delay Penalty'' as implemented in [[Micro-Max]] <ref>[http://home.hccnet.nl/h.g.muller/delay.html Evaluation: Aging - The Delay Penalty] from [[Micro-Max]] by [[Harm Geert Muller]]</ref> <ref>[http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&p=147295&t=15129 Re: Transposition Tables] by [[Harm Geert Muller]], [[CCC]], September 26, 2007</ref> <ref>[http://www.talkchess.com/forum/viewtopic.php?t=16751 Delayed-loss-bonus discussion goes here] by [[Harm Geert Muller]], [[CCC]], September 28, 2007</ref> <ref>[http://www.talkchess.com/forum/viewtopic.php?t=31981 Seeing a promotion, but not playing it...] by [[Harm Geert Muller]], [[CCC]], January 24, 2010</ref>.
  
 
=Detecting Mate=  
 
=Detecting Mate=  

Revision as of 11:59, 12 May 2018

Home * Chess * Checkmate

Shannon Larratt - Fool's mate (2007) [1] [2] [3]

Checkmate (often shortened to mate) occurs if a king is under immediate attack by one (or two) opponent pieces (in check) and has no way to remove it from attack on the next move. Checkmate is the object of the game of chess, it ends with the mate giving player as the winner, and the mated player the loser.

Mate Score

At the Root

At the root the score of a mated player is the worst score one can get, that is a negative score with the greatest absolute value of the score range. It is quite common and sufficient to use something like this in C, C++:

#include <limits.h>
/* (-32768/2 = -16384) */
#define VALUE_MATED (SHRT_MIN/2)

Inside a 16-bit short integer range, assuming centipawn evaluation, it translates to roughly being 16 queens down. Note that using SHRT_MIN instead of SHRT_MIN/2 as mate value has issues in greater/less comparisons of additive expressions, where summands around SHRT_MIN or SHRT_MAX may under- or overflow, which has somehow relaxed with the advent of the usual 32-bit sign-extension.

Down the Tree

Inside a negamax based search, most [4] programs assign VALUE_MATED + ply distance to the root as worst case score if entering a node, which if propagated as mate score along the Principal Variation to the root, translates in mate in odd plies (positive values), or getting mated in even plies. However, those scores need ply-adjustment if stored as exact score inside the transposition table, and re-adjustment if retrieving from TT. An alternative approach, not only related to mate scores was proposed by Harm Geert Muller, The Delay Penalty as implemented in Micro-Max [5] [6] [7] [8].

Detecting Mate

Some programs rely on pseudo-legal move generation, and find Checkmate if all those moves are in fact illegal after making and finding the "refutation" of capturing the king. At the latest, if no legal move was found, programs need the information whether the king is in check to decide about checkmate or stalemate score. Despite, most programs (should be) are aware of check in advance, and use special move generator(s) if in check or even in double check:

  1. Double check
    1. Only King moves or captures
  2. Single check
    1. Capture the checking piece
    2. King moves or captures
    3. In case of distant checks, interposing a piece between the threatening sliding piece and the king

See also

Publications

1952

1965 ...

1980 ...

1990 ...

2000 ...

2010 ...

Forum Posts

1997 ...

Re: Using too-shallow mate scores from the hash table by David Eppstein, CCC, July 06, 1998
Re: Using too-shallow mate scores from the hash table by Don Dailey, CCC, July 07, 1998
Is "Interesting mate test..." the longest ever thread.... by Tina Long, CCC, September 11, 1999

2000 ...

2005 ...

2010 ...

2015 ...

Leonid's Positions

Positions by Leonid Liberman

External Links

References

Up one Level