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