search: fixed a bug in NULL move pruning
[owl.git] / move.h
blob8e44ade633447d217a9558ced1983459c7a4976a
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 #define TYPE_PAWN_ONE 1
17 #define TYPE_PAWN_TWO 2
18 #define TYPE_CAPTURE 4
19 #define TYPE_PROMOTE 8
20 #define TYPE_CASTLE 16
21 #define TYPE_ENPASSANT 32
22 #define TYPE_TACTICAL (TYPE_CAPTURE | TYPE_ENPASSANT | TYPE_PROMOTE)
24 #define SET_FROM(x) (x)
25 #define SET_TO(x) ((x) << 6)
26 #define SET_TYPE(x) ((x) << 12)
27 #define SET_PROMOTE(x) ((x) << 18)
29 #define GET_FROM(x) ((x) & 0x3f)
30 #define GET_TO(x) (((x) >> 6) & 0x3f)
31 #define GET_TYPE(x) (((x) >> 12) & 0x3f)
32 #define GET_PROMOTE(x) (((x) >> 18) & 7)
34 #define MOVE_IS_TACTICAL(x) (GET_TYPE(x) & TYPE_TACTICAL)
35 #define PIECE(x) (square64[GET_FROM(x)])
36 #define CAP_PIECE(x) (square64[GET_TO(x)])
38 #define MAX_MOVES 512
40 struct moves_t {
41 int count;
42 int move[MAX_MOVES];
43 int score[MAX_MOVES];
44 int see[MAX_MOVES];
47 struct parsed_moves_t {
48 int count;
49 int move[MAX_MOVES];
50 char sans[MAX_MOVES][32];
53 void sort_moves(struct moves_t *moves, int current, int ply);
54 char *coord_move(int move, char *buf);
55 char *get_pv_string_coord(char * buf);
56 char *get_pv_string_san(char * buf);
57 int make_move(int move, int tb);
58 int move_is_legal(int move);
59 int parse_move_coord(char * move);
60 int parse_move_san(char * move);
61 void print_moves_coord(struct moves_t * moves);
62 void print_moves_san(struct moves_t *moves);
63 char *san_move(int move, char * buf);
64 void takeback(void);
65 void print_move_coord(int move);
67 int gen_legal_moves(struct moves_t *moves);
68 int gen_moves(struct moves_t *moves);
69 int gen_quiescent_moves(struct moves_t *moves, uint64_t target);