void operator<<(int bonus) {
assert(abs(bonus) <= D); // Ensure range is [-W * D, W * D]
- assert(abs(W * D) < std::numeric_limits<T>::max()); // Ensure we don't overflow
+ assert(W * D < std::numeric_limits<T>::max()); // Ensure we don't overflow
entry += bonus * W - entry * abs(bonus) / D;
/// 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;
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 ButterflyHistory* mainHistory;
const CapturePieceToHistory* captureHistory;
const PieceToHistory** contHistory;
- Move ttMove, refutations[3];
- ExtMove *cur, *endMoves, *endBadCaptures;
+ Move ttMove;
+ ExtMove refutations[3], *cur, *endMoves, *endBadCaptures;
int stage;
+ Move move;
Square recaptureSquare;
Value threshold;
Depth depth;