1 2 // board.h 3 4 #ifndef BOARD_H 5 #define BOARD_H 6 7 // includes 8 9 #include "colour.h" 10 #include "square.h" 11 #include "util.h" 12 13 // constants 14 15 const int Empty = 0; 16 17 const int SideH = 0; 18 const int SideA = 1; 19 const int SideNb = 2; 20 21 // types 22 23 struct board_t { 24 25 uint8 square[SquareNb]; 26 sint8 pos[SquareNb]; 27 28 uint8 list[ColourNb][32]; 29 sint8 list_size[ColourNb]; 30 31 sint8 number[12]; 32 33 sint8 turn; 34 uint8 castle[ColourNb][SideNb]; 35 uint8 ep_square; 36 37 sint16 ply_nb; 38 sint16 move_nb; 39 40 uint64 key; 41 }; 42 43 // functions 44 45 extern bool board_is_ok (const board_t * board); 46 47 extern void board_clear (board_t * board); 48 extern void board_start (board_t * board); 49 50 extern void board_copy (board_t * dst, const board_t * src); 51 extern bool board_equal (const board_t * board_1, const board_t * board_2); 52 53 extern void board_init_list (board_t * board); 54 55 extern int board_flags (const board_t * board); 56 57 extern bool board_can_play (const board_t * board); 58 extern int board_mobility (const board_t * board); 59 60 extern bool board_is_check (const board_t * board); 61 extern bool board_is_mate (const board_t * board); 62 extern bool board_is_stalemate (const board_t * board); 63 64 extern int king_pos (const board_t * board, int colour); 65 66 #endif // !defined BOARD_H 67 68 // end of board.h 69 70