Computer Chess Club Archives


Search

Terms

Messages

Subject: Static Mate Detection

Author: Gerd Isenberg

Date: 16:03:51 01/22/02


Some notes on Static Mate Detection (excuse my bad english)

In December, when i entered CCT4, i was quite sure to have the
Winboard-Interface ready with the help of some free days around christmas and
new year. But instead i had to solve some problems with the engine itself. Some
bugs in my static mate detection made me crazy.

Mate detection is part of the kingsafety-routine after or during scanning all
adjacent king squares, contolled by enemy pieces, specially sliders. Before,
during Piece evaluation, sevaral BitBoards got prepared with informations like
priorised square controls for both sides (tabu for kings, semitabu for queens
and rooks), squares, at least controlled twice (but no batteries), squares,
controlled by Sliders, RookMover and so on. Detection of pinned pieces and pawns
was also done. During "adjacent king squares controlled by slide"-scan, few more
BitBoards, indexed by direction (hor, ver, a1h8, h1a8) from one exclusive
sliding attacker, are evaluated to determine possible x-ray interrupts of the
potential mater, giving the king a possible escape square.

Mate detection is tried in following order:

1.supported queen mates adjacend to king (during the scan)
2.queen mates with straight distance two
3.mates with sliding pieces, if king can only move/capture in one or no
direction and no intermove (mate in one), or only worthless, mate delaying
intermoves are possible (determing them was the main problem) (mate in N; N>1).
Special care if distance to king is one or two (must be bishop or rook)
4.mates with knights
5.mates with pawns

Discoverd mate detection is not implemented, even if the information, a
discovered check is possible, is present. No mate detection if discovered slider
controls an exclusive escape square - and no mate detection if my statements are
too safe (hopefully not so often).

In my debug version, everery time a static mate is detected, a confirmation
search is done. If the search doesn't confirm the mate in one or N, i had an
error in my detection routine, the program aborts with a FEN-String in the
Clipboard. Shocked how often it occures.

Some examples:

Rd8+ mate in 2 ??

[D] 6k1/rq3pp1/p7/3R1NPQ/1p2r2P/8/PR4K1/8 w - -

Qc8+ mate in 2 ??

[D] 7k/4R2p/pp2Q3/3r2P1/P4p2/8/q7/2B2K2 w - -

one of the early ones:
Bf3+ mate ?? (h3 was controlled twice before, stil assumed as tabu)

[D] 1N4k1/P4p1p/8/4p3/4ppbb/4q3/2Q3KP/5B2 b - -


If the eval detects a mate for the side to move, it directly returns true mate
scores. If the side to move is forced to get mated, the search may get extended
by some fractional plies, specially by one ply if leave node and greater alpha.
Nullmove makes not much sence here.

I'm not quite sure whether a static mate evaluator pays off. It helps of course
in many tactical positions. With BitBoard-power it's rather loopless and not so
expensive as you may think - but there are a lot positions where many conditions
hit, but the final not. First the cheap one and later the one, which require
further calculation. On the other hand the whole thing is also used to get
positional values for the king or involved pieces (possibly huge, for example
only a heavy piece can "safe" intermove a check by a bishop, or an important
defending piece is attacked by a pawn).

It's very fascinating to look for safe boolean statements, which simply say
"mate". But it prevents me from doing more important, such as Winboard support.
I hope my C++ classes are well prepared for winboard. I deriver CSearchTree from
CNode (may be not a good idea to deriver from an instanciable class). After some
initialisations like setting up a Position, a CSearchTree-Object is able to
perform a search thread, expanding itselfs as a rootnode and CNodes as childs on
its stack.

cheers Gerd





This page took 0.13 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.