src/chess/rules.h

changeset 220
04da225a5677
parent 219
24b866230dd4
equal deleted inserted replaced
219:24b866230dd4 220:04da225a5677
661 * @param always_hours if hours should always be printed 661 * @param always_hours if hours should always be printed
662 */ 662 */
663 int print_clk(uint16_t time, char *str, bool always_hours); 663 int print_clk(uint16_t time, char *str, bool always_hours);
664 664
665 /** 665 /**
666 * Checks if the current position is a checkmate.
667 *
668 * This does a full recalculation. You should use the checkmate flag
669 * in the game state instead, if you want to test this after applying a
670 * move.
671 *
672 * @param gamestate the current game state
673 * @return true if the game is in a checkmate
674 */
675 bool check_checkmate(const GameState *gamestate);
676
677 /**
678 * Checks if the current position is a stalemate.
679 *
680 * This does a full recalculation. You should use the stalemate flag
681 * in the game state instead, if you want to test this after applying a
682 * move.
683 *
684 * @param gamestate the current game state
685 * @return true if the game is in a stalemate position
686 */
687 bool check_stalemate(const GameState *gamestate);
688
689 /**
666 * Checks if the current position already appeared two times before. 690 * Checks if the current position already appeared two times before.
667 * 691 *
668 * This does not set the threefold flag in the game state as this flag is 692 * This does not set the threefold flag in the game state as this flag is
669 * intended to be set only when the game ends after actually claiming a draw. 693 * intended to be set only when the game ends after actually claiming a draw.
670 * 694 *
683 * - they have only the king left 707 * - they have only the king left
684 * - they have a king + knight and the opponent has king + queens 708 * - they have a king + knight and the opponent has king + queens
685 * - they have a king + bishop and the opponent doesn't have 709 * - they have a king + bishop and the opponent doesn't have
686 * opposite color bishops or knights or pawns 710 * opposite color bishops or knights or pawns
687 * 711 *
712 * If you want to test this after applying a move, you should use the
713 * nomaterial flag in the game state, instead.
714 *
688 * @param gamestate the current game state 715 * @param gamestate the current game state
689 * @return true if neither side can win due to insufficient material 716 * @return true if neither side can win due to insufficient material
690 */ 717 */
691 bool check_no_material(const GameState *gamestate); 718 bool check_no_material(const GameState *gamestate);
692 719

mercurial