Analysis of positions with no legal moves
Posted: Thu Jan 24, 2013 7:49 am
When positions are given to a chess engine to analyze, sometimes there are no legal moves because the position is either a checkmate already or a stalemate.
For instance, stalemates:
1b2n3/5pkp/1p3p2/n2K1p1p/3N1P2/8/2rrq1N1/7b w - -
1b6/2R5/1p2n3/ppr5/1kp1b2p/2ppn3/2r1B2K/5q2 w - -
And some checkmates:
rnbqkbnr/pp1pp2p/2p2p2/6pQ/4P3/8/PPPP1PPP/RNB1KBNR b kq -
rnb1kbnr/ppp2ppp/4p3/3p4/5P2/N5qP/PPPPP3/R1BQKBNR w KQkq -
Defective:
rpqk2r/pp3ppp/2n2n2/1B1pp1B1/1b1PP1b1/2N2N2/PPP2PPP/R2QK2R w KQkq - (website software won't even try to render this one)
3K4/BBBBBBBB/1NNNNNN1/8/8/8/qqqqqqqq/3k4 w - -
2k5/pp5P/p6P/p6P/p6P/p6P/p5PP/5K2 w - -
2k5/pp6/p7/8/8/7P/6PP/5K2 w - -
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w kqKQ -
Programs will often refuse to analyze a position because it is illegal (e.g. 10 queens on the board, a pawn on the 7th rank, etc.)
When these conditions are encountered, it would be very nice if the chess engine would report what it saw. I would suggest that the following would be helpful:
c0 "Side to move in error";
c0 "Board representation fault";
c0 "Not exactly 8 rows in position";
c0 "Not exactly 8 squares in a row";
c0 "Pawn on rank 1";
c0 "Pawn on rank 8";
c0 "Too many major pieces (name the type if only one type in excess also)";
c0 "Too many promoted chessmen (combination is not possible)";
c0 "More than 8 white pawns";
c0 "More than 8 black pawns";
c0 "Wrong number of kings";
c0 "Adjacent kings";
c0 "Castle field error";
c0 "En passant square error";
c0 "White king in check with black to move";
c0 "Black king in check with white to move";
c0 "Less than 4 segments in the EPD record";
c0 "Position is currently checkmated (no legal moves)";
c0 "Position is currently stalemated (no legal moves)";
c0 "Too many black chessmen";
c0 "Too many white chessmen";
The reason a feature like this would be nice is that Epd positions are often analyzed in batch. Many sources of Epd have lots of bugs in the positions, and since the computer saw something it did not like, it would be really nice if they would tell us what. Sometimes, I want to repair them. Sometimes I just want to toss them out. But I can't really know that the chess engine did not simply crash and exit and I would be throwing out a good position or even if the engine misdiagnosed a problem (that happens too).
So, I am asking for an extension to the current analysis standard for chess programs and chess engines. If diagnostics could be added it would be double extra snappy good.
IMO-YMMV
For instance, stalemates:
1b2n3/5pkp/1p3p2/n2K1p1p/3N1P2/8/2rrq1N1/7b w - -
1b6/2R5/1p2n3/ppr5/1kp1b2p/2ppn3/2r1B2K/5q2 w - -
And some checkmates:
rnbqkbnr/pp1pp2p/2p2p2/6pQ/4P3/8/PPPP1PPP/RNB1KBNR b kq -
rnb1kbnr/ppp2ppp/4p3/3p4/5P2/N5qP/PPPPP3/R1BQKBNR w KQkq -
Defective:
rpqk2r/pp3ppp/2n2n2/1B1pp1B1/1b1PP1b1/2N2N2/PPP2PPP/R2QK2R w KQkq - (website software won't even try to render this one)
3K4/BBBBBBBB/1NNNNNN1/8/8/8/qqqqqqqq/3k4 w - -
2k5/pp5P/p6P/p6P/p6P/p6P/p5PP/5K2 w - -
2k5/pp6/p7/8/8/7P/6PP/5K2 w - -
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w kqKQ -
Programs will often refuse to analyze a position because it is illegal (e.g. 10 queens on the board, a pawn on the 7th rank, etc.)
When these conditions are encountered, it would be very nice if the chess engine would report what it saw. I would suggest that the following would be helpful:
c0 "Side to move in error";
c0 "Board representation fault";
c0 "Not exactly 8 rows in position";
c0 "Not exactly 8 squares in a row";
c0 "Pawn on rank 1";
c0 "Pawn on rank 8";
c0 "Too many major pieces (name the type if only one type in excess also)";
c0 "Too many promoted chessmen (combination is not possible)";
c0 "More than 8 white pawns";
c0 "More than 8 black pawns";
c0 "Wrong number of kings";
c0 "Adjacent kings";
c0 "Castle field error";
c0 "En passant square error";
c0 "White king in check with black to move";
c0 "Black king in check with white to move";
c0 "Less than 4 segments in the EPD record";
c0 "Position is currently checkmated (no legal moves)";
c0 "Position is currently stalemated (no legal moves)";
c0 "Too many black chessmen";
c0 "Too many white chessmen";
The reason a feature like this would be nice is that Epd positions are often analyzed in batch. Many sources of Epd have lots of bugs in the positions, and since the computer saw something it did not like, it would be really nice if they would tell us what. Sometimes, I want to repair them. Sometimes I just want to toss them out. But I can't really know that the chess engine did not simply crash and exit and I would be throwing out a good position or even if the engine misdiagnosed a problem (that happens too).
So, I am asking for an extension to the current analysis standard for chess programs and chess engines. If diagnostics could be added it would be double extra snappy good.
IMO-YMMV