Taking a promotion to avoid stalemate is optional (rule 3.9 c.7).
Example:
setoption name multipv value 20
setoption name UCI_Variant value sittuyin
position fen k5PK/3r4/8/8/8/8/8/8 b - - 0 1
go depth 1
No functional change for other variants.
return true;
}
+ // sittuyin stalemate due to optional promotion (3.9 c.7)
+ if ( sittuyin_promotion()
+ && count<ALL_PIECES>(sideToMove) == 2
+ && count<PAWN>(sideToMove) == 1
+ && !checkers())
+ {
+ bool promotionsOnly = true;
+ for (const auto& m : MoveList<LEGAL>(*this))
+ if (type_of(m) != PROMOTION)
+ {
+ promotionsOnly = false;
+ break;
+ }
+ if (promotionsOnly)
+ {
+ result = VALUE_DRAW;
+ return true;
+ }
+ }
+
return false;
}