diff --git a/src/search.cpp b/src/search.cpp index 12169dede..959792e42 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -144,7 +144,8 @@ void update_all_stats(const Position& pos, SearchedList& quietsSearched, SearchedList& capturesSearched, Depth depth, - Move ttMove); + Move ttMove, + bool PvNode); bool is_shuffling(Move move, Stack* const ss, const Position& pos) { if (pos.capture_stage(move) || pos.rule50_count() < 10) @@ -1477,7 +1478,7 @@ moves_loop: // When in check, search starts here else if (bestMove) { update_all_stats(pos, ss, *this, bestMove, prevSq, quietsSearched, capturesSearched, depth, - ttData.move); + ttData.move, PvNode); if (!PvNode) ttMoveHistory << (bestMove == ttData.move ? 792 : -779); } @@ -1871,7 +1872,8 @@ void update_all_stats(const Position& pos, SearchedList& quietsSearched, SearchedList& capturesSearched, Depth depth, - Move ttMove) { + Move ttMove, + bool PvNode) { CapturePieceToHistory& captureHistory = workerThread.captureHistory; Piece movedPiece = pos.moved_piece(bestMove); @@ -1881,6 +1883,11 @@ void update_all_stats(const Position& pos, std::min(134 * depth - 79, 1572) + 382 * (bestMove == ttMove) + (ss - 1)->statScore / 30; int malus = std::min(1005 * depth - 205, 2218); + if (!PvNode) + // Important: don't remove the cast to a 64-bit number else the multiplication + // can overflow on 32-bit platforms which would change the bench signature + bonus += bonus * uint64_t(quietsSearched.size() + capturesSearched.size()) / 256; + if (!pos.capture_stage(bestMove)) { update_quiet_histories(pos, ss, workerThread, bestMove, bonus * 824 / 1024);