138 isidx((move)->tofile) && isidx((move)->torow)) |
139 isidx((move)->tofile) && isidx((move)->torow)) |
139 |
140 |
140 /* secure versions - use, if index is not checked with isidx() */ |
141 /* secure versions - use, if index is not checked with isidx() */ |
141 #define fileidx_s(c) (isfile(c)?fileidx(c):POS_UNSPECIFIED) |
142 #define fileidx_s(c) (isfile(c)?fileidx(c):POS_UNSPECIFIED) |
142 #define rowidx_s(c) (isrow(c)?rowidx(c):POS_UNSPECIFIED) |
143 #define rowidx_s(c) (isrow(c)?rowidx(c):POS_UNSPECIFIED) |
|
144 |
|
145 #define is_game_running(gamestate) !((gamestate)->checkmate || \ |
|
146 (gamestate)->resign || (gamestate)->stalemate || (gamestate)->remis) |
|
147 |
|
148 |
|
149 /** |
|
150 * Initializes a game state and prepares the chess board. |
|
151 * @param gamestate the game state to initialize |
|
152 */ |
|
153 void gamestate_init(GameState *gamestate); |
143 |
154 |
144 /** |
155 /** |
145 * Cleans up a game state and frees the memory for the movement list. |
156 * Cleans up a game state and frees the memory for the movement list. |
146 * @param gamestate the game state to clean up |
157 * @param gamestate the game state to clean up |
147 */ |
158 */ |
274 * object. |
285 * object. |
275 * |
286 * |
276 * @param gamestate the current game state |
287 * @param gamestate the current game state |
277 * @param mstr the input string to parse |
288 * @param mstr the input string to parse |
278 * @param move a pointer to object where the move data shall be stored |
289 * @param move a pointer to object where the move data shall be stored |
|
290 * @param color the color of the player to evaluate the move for |
279 * @return status code (see macros in this file for the list of codes) |
291 * @return status code (see macros in this file for the list of codes) |
280 */ |
292 */ |
281 int eval_move(GameState *gamestate, char *mstr, Move *move); |
293 int eval_move(GameState *gamestate, char *mstr, Move *move, uint8_t color); |
282 |
294 |
283 /** |
295 /** |
284 * Validates move by applying chess rules. |
296 * Validates move by applying chess rules. |
285 * @param gamestate the current game state |
297 * @param gamestate the current game state |
286 * @param move the move to validate |
298 * @param move the move to validate |