From e2fdf6f005bd772b6d376c8ddeb14b12760f73c2 Mon Sep 17 00:00:00 2001 From: Shawn Xu Date: Thu, 21 Aug 2025 21:05:42 -0700 Subject: [PATCH] Simplify separate malus formulas Passed Non-regression STC: LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 16352 W: 4336 L: 4090 D: 7926 Ptnml(0-2): 54, 1832, 4157, 2080, 53 https://tests.stockfishchess.org/tests/view/68a808f0b6fb3300203bca08 Passed Non-regression LTC: LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 94014 W: 24129 L: 23986 D: 45899 Ptnml(0-2): 47, 9917, 26934, 10064, 45 https://tests.stockfishchess.org/tests/view/68a8f45cb6fb3300203bcb5e closes https://github.com/official-stockfish/Stockfish/pull/6256 Bench: 2483704 --- src/search.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 6a17e1624..40e8ef7cf 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1813,9 +1813,8 @@ void update_all_stats(const Position& pos, Piece movedPiece = pos.moved_piece(bestMove); PieceType capturedPiece; - int bonus = std::min(151 * depth - 91, 1730) + 302 * (bestMove == ttMove); - int quietMalus = std::min(798 * depth - 175, 2268) - 33 * quietsSearched.size(); - int captureMalus = std::min(757 * depth - 134, 2129) - 28 * capturesSearched.size(); + int bonus = std::min(151 * depth - 91, 1730) + 302 * (bestMove == ttMove); + int malus = std::min(951 * depth - 156, 2468) - 30 * quietsSearched.size(); if (!pos.capture_stage(bestMove)) { @@ -1823,7 +1822,7 @@ void update_all_stats(const Position& pos, // Decrease stats for all non-best quiet moves for (Move move : quietsSearched) - update_quiet_histories(pos, ss, workerThread, move, -quietMalus * 1208 / 1024); + update_quiet_histories(pos, ss, workerThread, move, -malus); } else { @@ -1835,15 +1834,14 @@ void update_all_stats(const Position& pos, // Extra penalty for a quiet early move that was not a TT move in // previous ply when it gets refuted. if (prevSq != SQ_NONE && ((ss - 1)->moveCount == 1 + (ss - 1)->ttHit) && !pos.captured_piece()) - update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, - -captureMalus * 594 / 1024); + update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -malus * 503 / 1024); // Decrease stats for all non-best capture moves for (Move move : capturesSearched) { movedPiece = pos.moved_piece(move); capturedPiece = type_of(pos.piece_on(move.to_sq())); - captureHistory[movedPiece][move.to_sq()][capturedPiece] << -captureMalus * 1366 / 1024; + captureHistory[movedPiece][move.to_sq()][capturedPiece] << -malus * 1157 / 1024; } }