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