1 2 // move.h 3 4 #ifndef MOVE_H 5 #define MOVE_H 6 7 // includes 8 9 #include "board.h" 10 #include "util.h" 11 12 // defined 13 14 // HACK: a1a1 cannot be a legal move 15 #define MoveNone (0) 16 17 #define MovePromoteKnight (1 << 12) 18 #define MovePromoteBishop (2 << 12) 19 #define MovePromoteRook (3 << 12) 20 #define MovePromoteQueen (4 << 12) 21 #define MoveFlags (7 << 12) 22 23 // types 24 25 typedef uint16 move_t; 26 27 // functions 28 29 extern bool move_is_ok (int move); 30 31 extern int move_make (int from, int to); 32 extern int move_make_flags (int from, int to, int flags); 33 34 extern int move_from (int move); 35 extern int move_to (int move); 36 extern int move_promote_hack (int move); 37 38 extern bool move_is_capture (int move, const board_t * board); 39 extern bool move_is_promote (int move); 40 extern bool move_is_en_passant (int move, const board_t * board); 41 extern bool move_is_castle (int move, const board_t * board); 42 43 extern int move_piece (int move, const board_t * board); 44 extern int move_capture (int move, const board_t * board); 45 extern int move_promote (int move, const board_t * board); 46 47 extern bool move_is_check (int move, const board_t * board); 48 extern bool move_is_mate (int move, const board_t * board); 49 50 extern int move_order (int move); 51 52 extern bool move_to_can (int move, const board_t * board, char string[], int size); 53 extern int move_from_can (const char string[], const board_t * board); 54 55 extern void move_disp (int move, const board_t * board); 56 57 #endif // !defined MOVE_H 58 59 // end of move.h 60 61