From 713000c517c63e6926bdbe1071e647280bc3da32 Mon Sep 17 00:00:00 2001 From: pb00067 Date: Sun, 24 Nov 2024 16:05:04 +0100 Subject: [PATCH] Same weight for black and white nonPawnCorrection history Since we don't have color dependent parameters in NNUE eval, it also has no sense IMO to have color dependent parameters in correction histories. Ideally a fixed depth search on a single thread should be determistic, so delivering the same result (move) if we just flip colors on the board. Patch replaces 2 parameters (122 and 185) with just one value 154 (= the avg of the two). Passed STC-non regression https://tests.stockfishchess.org/tests/view/6740a63286d5ee47d953f656 LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 122336 W: 31499 L: 31372 D: 59465 Ptnml(0-2): 336, 14535, 31301, 14658, 338 Passed LTC-non regression https://tests.stockfishchess.org/tests/view/67419bae86d5ee47d953f7b6 LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 101400 W: 25870 L: 25731 D: 49799 Ptnml(0-2): 78, 11109, 28166, 11290, 57 closes https://github.com/official-stockfish/Stockfish/pull/5698 Bench: 1215483 --- src/search.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 5209bd07..8ebbef5b 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1434,7 +1434,8 @@ moves_loop: // When in check, search starts here && ((bestValue < ss->staticEval && bestValue < beta) // negative correction & no fail high || (bestValue > ss->staticEval && bestMove))) // positive correction & no fail low { - const auto m = (ss - 1)->currentMove; + const auto m = (ss - 1)->currentMove; + static const int nonPawnWeight = 154; auto bonus = std::clamp(int(bestValue - ss->staticEval) * depth / 8, -CORRECTION_HISTORY_LIMIT / 4, CORRECTION_HISTORY_LIMIT / 4); @@ -1443,9 +1444,9 @@ moves_loop: // When in check, search starts here thisThread->majorPieceCorrectionHistory[us][major_piece_index(pos)] << bonus * 162 / 128; thisThread->minorPieceCorrectionHistory[us][minor_piece_index(pos)] << bonus * 148 / 128; thisThread->nonPawnCorrectionHistory[WHITE][us][non_pawn_index(pos)] - << bonus * 122 / 128; + << bonus * nonPawnWeight / 128; thisThread->nonPawnCorrectionHistory[BLACK][us][non_pawn_index(pos)] - << bonus * 185 / 128; + << bonus * nonPawnWeight / 128; if (m.is_ok()) (*(ss - 2)->continuationCorrectionHistory)[pos.piece_on(m.to_sq())][m.to_sq()] << bonus;