diff --git a/src/movepick.cpp b/src/movepick.cpp index 06ea5e25..c4eaa902 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -140,12 +140,12 @@ MovePicker::MovePicker(const Position& p, Move ttm, const HistoryStats& h, Piece } -/// stage_moves() returns a pointer to the beginning of moves array. It +/// quiet_moves() returns a pointer to the beginning of moves array. It /// is used to access already tried quiet moves when updating history. -const ExtMove* MovePicker::stage_moves() const { - assert(stage == KILLERS_S1 || stage == QUIETS_1_S1 || stage == QUIETS_2_S1); - return stage == KILLERS_S1 ? killers : moves; +const ExtMove* MovePicker::quiet_moves() const { + return stage == KILLERS_S1 ? killers + : stage == QUIETS_1_S1 || stage == QUIETS_2_S1 ? moves : NULL; } diff --git a/src/movepick.h b/src/movepick.h index 0a48c82d..3d4614cd 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -88,7 +88,7 @@ public: MovePicker(const Position&, Move, const HistoryStats&, PieceType); MovePicker(const Position&, Move, Depth, const HistoryStats&, Move*, Search::Stack*); - const ExtMove* stage_moves() const; + const ExtMove* quiet_moves() const; template Move next_move(); private: diff --git a/src/search.cpp b/src/search.cpp index 5aeb9a87..39e4be3d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1075,9 +1075,8 @@ moves_loop: // When in check and at SpNode search starts from here Value bonus = Value(int(depth) * int(depth)); History.update(pos.moved_piece(bestMove), to_sq(bestMove), bonus); - if (bestMove != ttMove) - for (const ExtMove* em = mp.stage_moves(); em->move != bestMove; ++em) - History.update(pos.moved_piece(em->move), to_sq(em->move), -bonus); + for (const ExtMove* em = mp.quiet_moves(); em && em->move != bestMove; ++em) + History.update(pos.moved_piece(em->move), to_sq(em->move), -bonus); if (is_ok((ss-1)->currentMove)) Countermoves.update(pos.piece_on(prevMoveSq), prevMoveSq, bestMove);