board.h (1065B)
1 #ifndef BOARD_H 2 #define BOARD_H 3 4 #include <cii/except.h> 5 #include "anki.h" 6 7 #define T Board_T 8 #define G Grave_T 9 10 typedef struct G *G; 11 typedef struct T *T; 12 13 extern const Except_T BOARDE_MOVE; 14 15 enum AC { AC_QUIT = -3, AC_SUSPEND, AC_INDEX }; 16 17 #define BUFF_SIZE 10 18 19 typedef int (*review_f)(void); 20 typedef struct game_T *game_T; 21 struct game_T { 22 card_T card; 23 char **moves; 24 review_f review_next; 25 26 int pass; 27 int fail; 28 29 size_t display_current; 30 size_t move_current; 31 32 size_t move_start; 33 size_t move_fail; 34 35 char buffer[BUFF_SIZE + 1]; 36 int buffer_crnt; 37 38 size_t moves_num; 39 T boards[]; 40 }; 41 42 T Board_new(void); 43 T Board_from_FEN(char *fen); 44 void Board_free(T *self); 45 46 T Board_play(T self, char *m, int white); 47 void Board_print(T self); 48 49 char Board_atIndex(T self, int i, int j); 50 51 int piece_get_index(char l); 52 53 G Board_grave(T self, char player); 54 char Grave_atIndex(G self, int index); 55 int Grave_size(G self); 56 57 /* GAME */ 58 game_T game_new(size_t moves); 59 60 /* MOVE */ 61 char **Move_list(char *pgn, size_t *size); 62 63 #undef T 64 #undef G 65 #endif