src/chess/rules.h

changeset 220
04da225a5677
parent 219
24b866230dd4
--- a/src/chess/rules.h	Sat Sep 05 12:36:04 2026 +0200
+++ b/src/chess/rules.h	Sat Sep 05 13:03:09 2026 +0200
@@ -663,6 +663,30 @@
 int print_clk(uint16_t time, char *str, bool always_hours);
 
 /**
+ * Checks if the current position is a checkmate.
+ *
+ * This does a full recalculation. You should use the checkmate flag
+ * in the game state instead, if you want to test this after applying a
+ * move.
+ *
+ * @param gamestate the current game state
+ * @return true if the game is in a checkmate
+ */
+bool check_checkmate(const GameState *gamestate);
+
+/**
+ * Checks if the current position is a stalemate.
+ *
+ * This does a full recalculation. You should use the stalemate flag
+ * in the game state instead, if you want to test this after applying a
+ * move.
+ *
+ * @param gamestate the current game state
+ * @return true if the game is in a stalemate position
+ */
+bool check_stalemate(const GameState *gamestate);
+
+/**
  * Checks if the current position already appeared two times before.
  *
  * This does not set the threefold flag in the game state as this flag is
@@ -685,6 +709,9 @@
  * - they have a king + bishop and the opponent doesn't have
  *   opposite color bishops or knights or pawns
  *
+ * If you want to test this after applying a move, you should use the
+ * nomaterial flag in the game state, instead.
+ *
  * @param gamestate the current game state
  * @return true if neither side can win due to insufficient material
  */

mercurial