From 29dbde739a74ebf661e4f7ae170fb090e0f7aec4 Mon Sep 17 00:00:00 2001 From: Linmiao Xu Date: Mon, 1 Jul 2024 16:26:44 -0400 Subject: [PATCH] Update 7 stat bonus/malus params Values found around 119k / 120k spsa games at 60+0.6: https://tests.stockfishchess.org/tests/view/6683112a192114e61f92f87a Passed STC: https://tests.stockfishchess.org/tests/view/66838148c4f539faa0326897 LLR: 2.95 (-2.94,2.94) <0.00,2.00> Total: 40928 W: 10835 L: 10508 D: 19585 Ptnml(0-2): 139, 4802, 10254, 5131, 138 Passed LTC: https://tests.stockfishchess.org/tests/view/668448a87a1863935cee42c6 LLR: 2.96 (-2.94,2.94) <0.50,2.50> Total: 29208 W: 7559 L: 7253 D: 14396 Ptnml(0-2): 17, 3118, 8019, 3442, 8 closes https://github.com/official-stockfish/Stockfish/pull/5439 bench 1138753 --- src/search.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 5eda1217b74..f74d4f87c5f 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -79,10 +79,10 @@ Value to_corrected_static_eval(Value v, const Worker& w, const Position& pos) { } // History and stats update bonus, based on depth -int stat_bonus(Depth d) { return std::clamp(186 * d - 285, 20, 1524); } +int stat_bonus(Depth d) { return std::clamp(191 * d - 285, 20, 1412); } // History and stats update malus, based on depth -int stat_malus(Depth d) { return (d < 4 ? 707 * d - 260 : 2073); } +int stat_malus(Depth d) { return (d < 4 ? 727 * d - 260 : 1908); } // Add a small random component to draw evaluations to avoid 3-fold blindness Value value_draw(size_t nodes) { return VALUE_DRAW - 1 + Value(nodes & 0x2); } @@ -1380,11 +1380,9 @@ Value Search::Worker::search( + 64 * (!ss->inCheck && bestValue <= ss->staticEval - 107) + 147 * (!(ss - 1)->inCheck && bestValue <= -(ss - 1)->staticEval - 75)); - - // proportional to "how much damage we have to undo" - if ((ss - 1)->statScore < -8000) - bonus += std::clamp(-(ss - 1)->statScore / 100, 0, 250); - + // Proportional to "how much damage we have to undo" + if ((ss - 1)->statScore < -7850) + bonus += std::clamp(-(ss - 1)->statScore / 100, 0, 224); update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, stat_bonus(depth) * bonus / 100); @@ -1801,7 +1799,7 @@ void update_all_stats(const Position& pos, if (!pos.capture_stage(bestMove)) { - int bestMoveBonus = bestValue > beta + 164 ? quietMoveBonus // larger bonus + int bestMoveBonus = bestValue > beta + 166 ? quietMoveBonus // larger bonus : stat_bonus(depth); // smaller bonus update_quiet_stats(pos, ss, workerThread, bestMove, bestMoveBonus);