src/chess/game-info.h

changeset 80
b980a7192b5a
parent 78
ceb9197b3c6d
equal deleted inserted replaced
79:ffd452cf05ff 80:b980a7192b5a
29 29
30 #ifndef GAME_INFO_H 30 #ifndef GAME_INFO_H
31 #define GAME_INFO_H 31 #define GAME_INFO_H
32 32
33 #include <stdint.h> 33 #include <stdint.h>
34 #include <stdbool.h>
34 35
35 #define WHITE 0x10 36 #define WHITE 0x10
36 #define BLACK 0x20 37 #define BLACK 0x20
37 #define opponent_color(color) ((color)==WHITE?BLACK:WHITE) 38 #define opponent_color(color) ((color)==WHITE?BLACK:WHITE)
38 39
97 typedef struct { 98 typedef struct {
98 Board board; 99 Board board;
99 MoveList* movelist; 100 MoveList* movelist;
100 MoveList* lastmove; 101 MoveList* lastmove;
101 unsigned int movecount; /* number of (half-)moves (counting BOTH colors) */ 102 unsigned int movecount; /* number of (half-)moves (counting BOTH colors) */
102 _Bool checkmate; 103 bool checkmate;
103 _Bool stalemate; 104 bool stalemate;
104 _Bool remis; 105 bool remis;
105 _Bool resign; 106 bool resign;
106 } GameState; 107 } GameState;
107 108
108 109
109 #define is_game_running(gamestate) !((gamestate)->checkmate || \ 110 #define is_game_running(gamestate) !((gamestate)->checkmate || \
110 (gamestate)->resign || (gamestate)->stalemate || (gamestate)->remis) 111 (gamestate)->resign || (gamestate)->stalemate || (gamestate)->remis)

mercurial