2 * Copyright (C) 2007-2011 Vincent Ollivier
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 enum NodeType
: unsigned char {PV_NODE
, CUT_NODE
, ALL_NODE
};
38 Move killer_moves
[MAX_DEPTH
][2];
42 unsigned int nodes_count
; // Used in search
43 //list<Move> moves_history; // Temporary
50 void add_piece(Color c
, PieceType t
, Square s
);
51 void del_piece(Color c
, PieceType t
, int i
);
52 void del_piece(Piece p
) {
53 del_piece(p
.get_color(), p
.get_type(), p
.get_index());
58 Node
& current_node() { return tree
.top(); };
60 void init(string fen
);
62 bool is_check(Color c
) const {
63 return board
.is_attacked_by(Color(!c
),
64 pieces
.get_position(c
, KING
, 0),
69 //Moves movegen(bool captures_only = false);
70 void make_move(Move m
);
71 void undo_move(Move m
);
72 bool is_legal(Move m
);
76 int quiescence_search(int alpha
, int beta
, int depth
);
77 //int alphabeta_search(int alpha, int beta, int depth);
78 int pv_search(int alpha
, int beta
, int depth
, NodeType node_type
);
79 Move
root(int max_depth
);
82 Move
get_killer_move(int depth
, int index
) {
83 return killer_moves
[depth
][index
];
85 void set_killer_move(int depth
, Move move
);
86 bool is_killer_move(int depth
, Move move
) {
87 return (move
== killer_moves
[depth
][0] ||
88 move
== killer_moves
[depth
][1]);
91 // Position's evaluation
92 int piece_eval(Color c
, PieceType t
, int i
);
96 void print_thinking_header();
97 void print_thinking(int depth
, int score
, Move m
);
98 string
output_principal_variation(int depth
, Move m
);
99 string
output_move(Move m
);
100 string
output_square(Square s
) {
101 return output_square(board
.get_file(s
), board
.get_rank(s
));
103 string
output_square(File f
, Rank r
);
104 void print_tt_stats();