From: Fabian Fichter Date: Sun, 20 Aug 2023 10:51:17 +0000 (+0200) Subject: Fix custom king insufficient material X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=ac35f892fbd30a7380904d325d0af44959f3acb4;p=fairystockfish.git Fix custom king insufficient material Closes #686. --- diff --git a/src/apiutil.h b/src/apiutil.h index d753579..ca5858e 100644 --- a/src/apiutil.h +++ b/src/apiutil.h @@ -404,6 +404,11 @@ inline bool has_insufficient_material(Color c, const Position& pos) { if ((pos.pieces(c) & unbound) && (popcount(pos.pieces() ^ restricted) >= 2 || pos.stalemate_value() != VALUE_DRAW || pos.check_counting() || pos.makpong())) return false; + // Non-draw stalemate with lone custom king + if ( pos.stalemate_value() != VALUE_DRAW && pos.king_type() != KING + && pos.pieces(c, KING) && (pos.board_bb(c, KING) & pos.board_bb(~c, KING))) + return false; + return true; } diff --git a/test.py b/test.py index 3a40a54..1155817 100644 --- a/test.py +++ b/test.py @@ -84,6 +84,13 @@ capturesToHand = true firstRankPawnDrops = true promotionZonePawnDrops = true immobilityIllegal = true + +[wazirking:chess] +fers = q +king = k:W +startFen = 7k/5Kq1/8/8/8/8/8/8 w - - 0 1 +stalemateValue = loss +nFoldValue = loss """ sf.load_variant_config(ini_text) @@ -193,6 +200,9 @@ variant_positions = { "10/5k4/10/10/10/10/10/10/5KC3/10 w - - 0 1": (False, True), # KC vs K "10/5k4/10/10/10/10/10/10/5K4/10 w - - 0 1": (True, True), # K vs K }, + "wazirking": { + "7k/6K1/8/8/8/8/8/8 b - - 0 1": (False, False), # K vs K + }, } invalid_variant_positions = {