Document where we want a uint16_t instead of a uint64_t
[glaurung_clone.git] / src / movepick.h
blobca052c7bd1901c250f35d0fea3aaf0c5fc422a05
1 /*
2 Glaurung, a UCI chess playing engine.
3 Copyright (C) 2004-2008 Tord Romstad
5 Glaurung is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 Glaurung is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #if !defined MOVEPICK_H_INCLUDED
21 #define MOVEPICK_H_INCLUDED
23 ////
24 //// Includes
25 ////
27 #include "depth.h"
28 #include "lock.h"
29 #include "position.h"
32 ////
33 //// Types
34 ////
36 /// MovePicker is a class which is used to pick one legal move at a time from
37 /// the current position. It is initialized with a Position object and a few
38 /// moves we have reason to believe are good. The most important method is
39 /// MovePicker::pick_next_move(), which returns a new legal move each time it
40 /// is called, until there are no legal moves left, when MOVE_NONE is returned.
41 /// In order to improve the efficiency of the alpha beta algorithm, MovePicker
42 /// attempts to return the moves which are most likely to be strongest first.
44 class MovePicker {
46 public:
47 MovePicker(Position &p, bool pvnode, Move ttm, Move mk, Move k1, Move k2,
48 Depth dpth);
49 Move get_next_move();
50 Move get_next_move(Lock &lock);
51 int number_of_moves() const;
52 int current_move_score() const;
53 Bitboard discovered_check_candidates();
55 static void init_phase_table();
57 private:
58 void score_captures();
59 void score_noncaptures();
60 void score_evasions();
61 void score_qcaptures();
62 Move pick_move_from_list();
64 Position *pos;
65 Move ttMove, mateKiller, killer1, killer2;
66 Bitboard pinned, dc;
67 MoveStack moves[256], badCaptures[64];
68 bool pvNode;
69 Depth depth;
70 int phaseIndex;
71 int numOfMoves, numOfBadCaptures;
72 int movesPicked, badCapturesPicked;
73 bool finished;
77 ////
78 //// Inline functions
79 ////
81 /// MovePicker::discovered_check_candidates() returns a bitboard containing
82 /// all pieces which can possibly give discovered check. This bitboard is
83 /// computed by the constructor function.
85 inline Bitboard MovePicker::discovered_check_candidates() {
86 return dc;
89 #endif // !defined(MOVEPICK_H_INCLUDED)