]> git.sesse.net Git - stockfish/blob - src/movepick.h
Retire move.h
[stockfish] / src / movepick.h
1 /*
2   Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3   Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
4   Copyright (C) 2008-2010 Marco Costalba, Joona Kiiski, Tord Romstad
5
6   Stockfish is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   Stockfish is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #if !defined MOVEPICK_H_INCLUDED
21 #define MOVEPICK_H_INCLUDED
22
23 #include "history.h"
24 #include "position.h"
25 #include "types.h"
26
27 struct SearchStack;
28
29 /// MovePicker is a class which is used to pick one pseudo legal move at a time
30 /// from the current position. It is initialized with a Position object and a few
31 /// moves we have reason to believe are good. The most important method is
32 /// MovePicker::get_next_move(), which returns a new pseudo legal move each time
33 /// it is called, until there are no moves left, when MOVE_NONE is returned.
34 /// In order to improve the efficiency of the alpha beta algorithm, MovePicker
35 /// attempts to return the moves which are most likely to get a cut-off first.
36
37 class MovePicker {
38
39   MovePicker& operator=(const MovePicker&); // Silence a warning under MSVC
40
41 public:
42   MovePicker(const Position&, Move, Depth, const History&, SearchStack*, Value);
43   MovePicker(const Position&, Move, Depth, const History&, Square recaptureSq);
44   MovePicker(const Position&, Move, const History&, PieceType parentCapture);
45   Move get_next_move();
46
47 private:
48   void score_captures();
49   void score_noncaptures();
50   void score_evasions();
51   void go_next_phase();
52
53   const Position& pos;
54   const History& H;
55   Depth depth;
56   Move ttMove;
57   MoveStack killers[2];
58   Square recaptureSquare;
59   int captureThreshold, phase;
60   const uint8_t* phasePtr;
61   MoveStack *curMove, *lastMove, *lastNonCapture, *badCaptures;
62   MoveStack moves[MAX_MOVES];
63 };
64
65 #endif // !defined(MOVEPICK_H_INCLUDED)