--- a/src/chess/rules.h Tue Jun 03 08:43:17 2025 +0200 +++ b/src/chess/rules.h Wed Jun 04 23:56:40 2025 +0200 @@ -33,6 +33,7 @@ #include "game-info.h" #include <stdint.h> +#include <stdbool.h> #define VALID_MOVE_SYNTAX 0 #define VALID_MOVE_SEMANTICS 0 /* use same code for a success */ @@ -114,10 +115,10 @@ * the rare maximum of 16 elements) * @param threatcount a pointer to an uint8_t where the count of threats is * stored - * @return TRUE, if any piece of the specified color threatens the specified + * @return true, if any piece of the specified color threatens the specified * field (i.e. could capture an opponent piece) */ -_Bool get_threats(GameState *gamestate, uint8_t row, uint8_t file, +bool get_threats(GameState *gamestate, uint8_t row, uint8_t file, uint8_t color, Move* threats, uint8_t* threatcount); /** @@ -135,10 +136,10 @@ * the rare maximum of 16 elements) * @param threatcount a pointer to an uint8_t where the count of threats is * stored - * @return TRUE, if any piece of the specified color threatens the specified + * @return true, if any piece of the specified color threatens the specified * field (i.e. could capture an opponent piece) */ -_Bool get_real_threats(GameState *gamestate, uint8_t row, uint8_t file, +bool get_real_threats(GameState *gamestate, uint8_t row, uint8_t file, uint8_t color, Move* threats, uint8_t* threatcount); /** @@ -148,7 +149,7 @@ * @param row row of the field to check * @param file file of the field to check * @param color the color of the piece that should cover the field - * @return TRUE, if any piece of the specified color threatens the specified + * @return true, if any piece of the specified color threatens the specified * field */ #define is_covered(gamestate, row, file, color) \ @@ -164,7 +165,7 @@ * @param row row of the field to check * @param file file of the field to check * @param color the color of the piece that should cover the field - * @return TRUE, if any piece of the specified color threatens the specified + * @return true, if any piece of the specified color threatens the specified * field and could capture an opponent piece */ #define is_attacked(gamestate, row, file, color) \ @@ -180,10 +181,10 @@ * @param row row of the field to check * @param file file of the field to check * @param color the color of the piece that should cover the field - * @return TRUE, if any piece (excluding the king) of the specified color + * @return true, if any piece (excluding the king) of the specified color * threatens the specified field and could capture an opponent piece */ -_Bool is_protected(GameState *gamestate, uint8_t row, uint8_t file, +bool is_protected(GameState *gamestate, uint8_t row, uint8_t file, uint8_t color); /** @@ -197,10 +198,10 @@ * * @param gamestate the current game state * @param move the move to check - * @return TRUE, if the move cannot be performed because the king would be in + * @return true, if the move cannot be performed because the king would be in * check after the move */ -_Bool is_pinned(GameState *gamestate, Move *move); +bool is_pinned(GameState *gamestate, Move *move); /** * Evaluates a move syntactically and stores the move data in the specified