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