src/chess/rules.h

changeset 27
efeb98bc69c9
parent 26
e0a76ee1bb2b
child 28
0c1371488d87
equal deleted inserted replaced
26:e0a76ee1bb2b 27:efeb98bc69c9
75 uint8_t fromrow; 75 uint8_t fromrow;
76 uint8_t tofile; 76 uint8_t tofile;
77 uint8_t torow; 77 uint8_t torow;
78 uint8_t promotion; 78 uint8_t promotion;
79 _Bool check; 79 _Bool check;
80 _Bool checkmate;
81 _Bool stalemate; // TODO: find a better place for checkmate and stalemate
82 _Bool capture; 80 _Bool capture;
83 } Move; 81 } Move;
84 82
85 typedef struct MoveList MoveList; 83 typedef struct MoveList MoveList;
86 84
92 typedef struct { 90 typedef struct {
93 Board board; 91 Board board;
94 uint8_t mycolor; 92 uint8_t mycolor;
95 MoveList* movelist; 93 MoveList* movelist;
96 MoveList* lastmove; 94 MoveList* lastmove;
95 _Bool checkmate;
96 _Bool stalemate;
97 } GameState; 97 } GameState;
98 98
99 #define opponent_color(color) ((color)==WHITE?BLACK:WHITE) 99 #define opponent_color(color) ((color)==WHITE?BLACK:WHITE)
100 100
101 #define POS_UNSPECIFIED UINT8_MAX 101 #define POS_UNSPECIFIED UINT8_MAX

mercurial