From d7c04a942950f1fe3f655bf8b608e8ef21c07628 Mon Sep 17 00:00:00 2001 From: Shawn Xu Date: Mon, 31 Mar 2025 21:15:56 -0700 Subject: [PATCH] Introduce TT Move History Double Extensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Passed VVLTC w/ STC bounds: LLR: 2.94 (-2.94,2.94) <0.00,2.00> Total: 74918 W: 19436 L: 19120 D: 36362 Ptnml(0-2): 6, 6890, 23354, 7200, 9 https://tests.stockfishchess.org/tests/view/67e4a1088888403457d878bb Passed VVLTC w/ LTC bounds: LLR: 2.95 (-2.94,2.94) <0.50,2.50> Total: 111706 W: 29050 L: 28619 D: 54037 Ptnml(0-2): 13, 10218, 34959, 10651, 12 https://tests.stockfishchess.org/tests/view/67d6877c517865b4a2dfd36b STC Elo Estimate: Elo: 1.26 ± 2.0 (95%) LOS: 88.8% Total: 30000 W: 7855 L: 7746 D: 14399 Ptnml(0-2): 104, 3531, 7630, 3622, 113 nElo: 2.44 ± 3.9 (95%) PairsRatio: 1.03 https://tests.stockfishchess.org/tests/view/67eacb8c31d7cf8afdc44b99 closes https://github.com/official-stockfish/Stockfish/pull/5961 Bench: 1887897 --- src/history.h | 2 ++ src/search.cpp | 12 +++++++++++- src/search.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/history.h b/src/history.h index ec245230a..f2ef7661f 100644 --- a/src/history.h +++ b/src/history.h @@ -166,6 +166,8 @@ struct CorrHistTypedef { template using CorrectionHistory = typename Detail::CorrHistTypedef::type; +using TTMoveHistory = Stats; + } // namespace Stockfish #endif // #ifndef HISTORY_H_INCLUDED diff --git a/src/search.cpp b/src/search.cpp index 5f5934a49..291b99bd1 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -580,6 +580,8 @@ void Search::Worker::clear() { minorPieceCorrectionHistory.fill(0); nonPawnCorrectionHistory.fill(0); + ttMoveHistory.fill(0); + for (auto& to : continuationCorrectionHistory) for (auto& h : to) h.fill(5); @@ -1139,7 +1141,8 @@ moves_loop: // When in check, search starts here { int corrValAdj1 = std::abs(correctionValue) / 248873; int corrValAdj2 = std::abs(correctionValue) / 255331; - int doubleMargin = 262 * PvNode - 188 * !ttCapture - corrValAdj1; + int doubleMargin = 262 * PvNode - 188 * !ttCapture - corrValAdj1 + - ttMoveHistory[pawn_structure_index(pos)][us] / 128; int tripleMargin = 88 + 265 * PvNode - 256 * !ttCapture + 93 * ss->ttPv - corrValAdj2; @@ -1430,8 +1433,15 @@ moves_loop: // When in check, search starts here // If there is a move that produces search value greater than alpha, // we update the stats of searched moves. else if (bestMove) + { update_all_stats(pos, ss, *this, bestMove, prevSq, quietsSearched, capturesSearched, depth, bestMove == ttData.move, moveCount); + if (!PvNode) + { + int bonus = (ttData.move == move) ? 800 : -600 * moveCount; + ttMoveHistory[pawn_structure_index(pos)][us] << bonus; + } + } // Bonus for prior quiet countermove that caused the fail low else if (!priorCapture && prevSq != SQ_NONE) diff --git a/src/search.h b/src/search.h index 071773f81..6ef8322a8 100644 --- a/src/search.h +++ b/src/search.h @@ -292,6 +292,8 @@ class Worker { CorrectionHistory nonPawnCorrectionHistory; CorrectionHistory continuationCorrectionHistory; + TTMoveHistory ttMoveHistory; + private: void iterative_deepening();