src/chess/rules.h

changeset 173
e541b6002933
parent 171
09f18c3316f9
equal deleted inserted replaced
172:ba1bf80d10cc 173:e541b6002933
193 static inline bool enpassant_threat_exists(const GameState *gamestate, 193 static inline bool enpassant_threat_exists(const GameState *gamestate,
194 Row row, File file) { 194 Row row, File file) {
195 return gamestate->board[row][file] & ENPASSANT_THREAT; 195 return gamestate->board[row][file] & ENPASSANT_THREAT;
196 } 196 }
197 197
198 static inline bool is_game_drawn(const GameState *gamestate) {
199 return gamestate->threefold || gamestate->stalemate || gamestate->remis;
200 }
201
198 static inline bool is_game_running(const GameState *gamestate) { 202 static inline bool is_game_running(const GameState *gamestate) {
199 return !(gamestate->checkmate || gamestate->wresign || gamestate->bresign 203 return !(gamestate->checkmate || gamestate->wresign || gamestate->bresign
200 || gamestate->threefold || gamestate->stalemate || gamestate->remis 204 || is_game_drawn(gamestate) || gamestate->review);
201 || gamestate->review);
202 } 205 }
203 206
204 static inline bool is_check_position(const GameState *gamestate) { 207 static inline bool is_check_position(const GameState *gamestate) {
205 return gamestate->moves[gamestate->movecount - 1].check; 208 return gamestate->moves[gamestate->movecount - 1].check;
206 } 209 }

mercurial