From ced9f69834378f88efbf196d05666fb058fc4b00 Mon Sep 17 00:00:00 2001 From: Michael Chaly Date: Mon, 29 Dec 2025 10:47:40 +0300 Subject: [PATCH] Adjust main history with every new root position this patch dampens down main history to 3/4 of it value for all possible moves at the start of ID loop, making it partially refresh with every new root position. Passed STC: https://tests.stockfishchess.org/tests/view/694e33ff572093c1986d7234 LLR: 2.93 (-2.94,2.94) <0.00,2.00> Total: 115520 W: 30164 L: 29735 D: 55621 Ptnml(0-2): 395, 13192, 30192, 13551, 430 Passed LTC: https://tests.stockfishchess.org/tests/view/6950cbe6572093c1986d816c LLR: 2.95 (-2.94,2.94) <0.50,2.50> Total: 63672 W: 16480 L: 16114 D: 31078 Ptnml(0-2): 46, 6524, 18329, 6892, 45 closes https://github.com/official-stockfish/Stockfish/pull/6504 bench 2710946 --- src/search.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/search.cpp b/src/search.cpp index c1a7d5880..05f9b47fa 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -65,6 +65,7 @@ using namespace Search; namespace { constexpr int SEARCHEDLIST_CAPACITY = 32; +constexpr int mainHistoryDefault = 68; using SearchedList = ValueList; // (*Scalers): @@ -312,6 +313,10 @@ void Search::Worker::iterative_deepening() { lowPlyHistory.fill(97); + for (Color c: {WHITE, BLACK}) + for (int i = 0; i < UINT_16_HISTORY_SIZE; i++) + mainHistory[c][i] = (mainHistory[c][i] - mainHistoryDefault) * 3 / 4 + mainHistoryDefault; + // Iterative deepening loop until requested to stop or the target depth is reached while (++rootDepth < MAX_PLY && !threads.stop && !(limits.depth && mainThread && rootDepth > limits.depth)) @@ -578,7 +583,7 @@ void Search::Worker::undo_null_move(Position& pos) { pos.undo_null_move(); } // Reset histories, usually before a new game void Search::Worker::clear() { - mainHistory.fill(68); + mainHistory.fill(mainHistoryDefault); captureHistory.fill(-689); // Each thread is responsible for clearing their part of shared history