+/// PieceToHistory is like ButterflyHistory but is addressed by a move's [piece][to]
+typedef Stats<int16_t, 29952, PIECE_NB, SQUARE_NB> PieceToHistory;
+
+/// ContinuationHistory is the combined history of a given pair of moves, usually
+/// the current one given a previous one. The nested history table is based on
+/// PieceToHistory instead of ButterflyBoards.
+typedef Stats<PieceToHistory, NOT_USED, PIECE_NB, SQUARE_NB> ContinuationHistory;
+
+
+/// MovePicker class is used to pick one pseudo legal move at a time from the
+/// current position. The most important method is next_move(), which returns a
+/// new pseudo legal move each time it is called, until there are no moves left,
+/// when MOVE_NONE is returned. In order to improve the efficiency of the alpha
+/// beta algorithm, MovePicker attempts to return the moves which are most likely
+/// to get a cut-off first.
+class MovePicker {
+
+ enum PickType { Next, Best };
+
+public:
+ MovePicker(const MovePicker&) = delete;
+ MovePicker& operator=(const MovePicker&) = delete;
+ MovePicker(const Position&, Move, Value, const CapturePieceToHistory*);
+ MovePicker(const Position&, Move, Depth, const ButterflyHistory*,
+ const CapturePieceToHistory*,
+ Square);
+ MovePicker(const Position&, Move, Depth, const ButterflyHistory*,
+ const CapturePieceToHistory*,
+ const PieceToHistory**,
+ Move,
+ Move*);
+ Move next_move(bool skipQuiets = false);
+
+private:
+ template<PickType T, typename Pred> Move select(Pred);
+ template<GenType> void score();
+ ExtMove* begin() { return cur; }
+ ExtMove* end() { return endMoves; }
+
+ const Position& pos;
+ const ButterflyHistory* mainHistory;
+ const CapturePieceToHistory* captureHistory;
+ const PieceToHistory** contHistory;
+ Move ttMove;
+ ExtMove refutations[3], *cur, *endMoves, *endBadCaptures;
+ int stage;
+ Move move;
+ Square recaptureSquare;
+ Value threshold;
+ Depth depth;
+ ExtMove moves[MAX_MOVES];
+};