From b177b7394a5506b5a118eec96d5dd80ff3a10498 Mon Sep 17 00:00:00 2001 From: KazApps Date: Tue, 29 Jul 2025 13:12:44 +0900 Subject: [PATCH] Separate bonus/malus parameters for quiet and capture moves Parameters were tuned on 60k STC games. Passed STC LLR: 2.95 (-2.94,2.94) <0.00,2.00> Total: 16928 W: 4570 L: 4277 D: 8081 Ptnml(0-2): 57, 1905, 4270, 2152, 80 https://tests.stockfishchess.org/tests/view/688b4486502b34dd5e711122 Passed LTC LLR: 2.94 (-2.94,2.94) <0.50,2.50> Total: 43602 W: 11373 L: 11041 D: 21188 Ptnml(0-2): 23, 4657, 12116, 4975, 30 https://tests.stockfishchess.org/tests/view/688c0eb5502b34dd5e71124b Passed non-regression VLTC LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 181016 W: 46335 L: 46281 D: 88400 Ptnml(0-2): 33, 18177, 54034, 18231, 33 https://tests.stockfishchess.org/tests/view/688e0a77f17748b4d23c822b closes https://github.com/official-stockfish/Stockfish/pull/6200 bench: 3435529 --- src/search.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index b5e6e1be9..39d9862be 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -129,8 +129,7 @@ void update_all_stats(const Position& pos, SearchedList& quietsSearched, SearchedList& capturesSearched, Depth depth, - Move TTMove, - int moveCount); + Move TTMove); } // namespace @@ -1400,7 +1399,7 @@ moves_loop: // When in check, search starts here else if (bestMove) { update_all_stats(pos, ss, *this, bestMove, prevSq, quietsSearched, capturesSearched, depth, - ttData.move, moveCount); + ttData.move); if (!PvNode) ttMoveHistory << (bestMove == ttData.move ? 811 : -848); } @@ -1811,42 +1810,44 @@ void update_all_stats(const Position& pos, SearchedList& quietsSearched, SearchedList& capturesSearched, Depth depth, - Move ttMove, - int moveCount) { + Move ttMove) { CapturePieceToHistory& captureHistory = workerThread.captureHistory; Piece movedPiece = pos.moved_piece(bestMove); PieceType capturedPiece; - int bonus = std::min(142 * depth - 88, 1501) + 318 * (bestMove == ttMove); - int malus = std::min(757 * depth - 172, 2848) - 30 * moveCount; + int quietBonus = std::min(170 * depth - 87, 1598) + 332 * (bestMove == ttMove); + int quietMalus = std::min(743 * depth - 180, 2287) - 33 * quietsSearched.size(); + int captureBonus = std::min(124 * depth - 62, 1245) + 336 * (bestMove == ttMove); + int captureMalus = std::min(708 * depth - 148, 2287) - 29 * capturesSearched.size(); if (!pos.capture_stage(bestMove)) { - update_quiet_histories(pos, ss, workerThread, bestMove, bonus * 1054 / 1024); + update_quiet_histories(pos, ss, workerThread, bestMove, quietBonus * 978 / 1024); // Decrease stats for all non-best quiet moves for (Move move : quietsSearched) - update_quiet_histories(pos, ss, workerThread, move, -malus * 1388 / 1024); + update_quiet_histories(pos, ss, workerThread, move, -quietMalus * 1115 / 1024); } else { // Increase stats for the best move in case it was a capture move capturedPiece = type_of(pos.piece_on(bestMove.to_sq())); - captureHistory[movedPiece][bestMove.to_sq()][capturedPiece] << bonus * 1235 / 1024; + captureHistory[movedPiece][bestMove.to_sq()][capturedPiece] << captureBonus * 1288 / 1024; } // 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, -malus * 595 / 1024); + update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, + -captureMalus * 622 / 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] << -malus * 1354 / 1024; + captureHistory[movedPiece][move.to_sq()][capturedPiece] << -captureMalus * 1431 / 1024; } }