From c83ddd9e4b9d5c57c9398565eee52c3ea5940f80 Mon Sep 17 00:00:00 2001 From: Stefan Geschwentner Date: Thu, 30 Jan 2025 22:36:00 +0100 Subject: [PATCH] Tweak correction history factors The values are taken from this tuning https://tests.stockfishchess.org/tests/view/679c4e150774dfd78deaf376 which added also a new material correction history. The full tune doesn't work but ignoring the new history results in this changes. Passed STC: LLR: 2.94 (-2.94,2.94) <0.00,2.00> Total: 102368 W: 27057 L: 26638 D: 48673 Ptnml(0-2): 394, 12031, 25949, 12382, 428 https://tests.stockfishchess.org/tess/view/679d2ca70774dfd78deaf796 Passed LTC: LLR: 2.96 (-2.94,2.94) <0.50,2.50> Total: 55044 W: 14215 L: 13855 D: 26974 Ptnml(0-2): 43, 5956, 15172, 6300, 51 https://tests.stockfishchess.org/tests/view/679d30be0774dfd78deafda2 closes https://github.com/official-stockfish/Stockfish/pull/5841 Bench: 3068583 --- src/history.h | 2 +- src/position.cpp | 13 ++----------- src/search.cpp | 11 ++++++----- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/history.h b/src/history.h index bec055d5..9ae7bdad 100644 --- a/src/history.h +++ b/src/history.h @@ -132,7 +132,7 @@ using PawnHistory = Statskey = st->materialKey = 0; + st->minorPieceKey = 0; st->nonPawnKey[WHITE] = st->nonPawnKey[BLACK] = 0; st->pawnKey = Zobrist::noPawns; st->nonPawnMaterial[WHITE] = st->nonPawnMaterial[BLACK] = VALUE_ZERO; @@ -362,11 +363,6 @@ void Position::set_state() const { if (type_of(pc) <= BISHOP) st->minorPieceKey ^= Zobrist::psq[pc][s]; } - - else - { - st->minorPieceKey ^= Zobrist::psq[pc][s]; - } } } @@ -867,12 +863,7 @@ void Position::do_move(Move m, { st->nonPawnKey[us] ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to]; - if (type_of(pc) == KING) - { - st->minorPieceKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to]; - } - - else if (type_of(pc) <= BISHOP) + if (type_of(pc) <= BISHOP) st->minorPieceKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to]; } diff --git a/src/search.cpp b/src/search.cpp index d6e9bb75..a35aad45 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -94,7 +94,7 @@ int correction_value(const Worker& w, const Position& pos, const Stack* const ss m.is_ok() ? (*(ss - 2)->continuationCorrectionHistory)[pos.piece_on(m.to_sq())][m.to_sq()] : 0; - return (7000 * pcv + 6300 * micv + 7550 * (wnpcv + bnpcv) + 6320 * cntcv); + return 7037 * pcv + 6671 * micv + 7631 * (wnpcv + bnpcv) + 6362 * cntcv; } // Add correctionHistory value to raw staticEval and guarantee evaluation @@ -110,18 +110,19 @@ void update_correction_history(const Position& pos, const Move m = (ss - 1)->currentMove; const Color us = pos.side_to_move(); - static constexpr int nonPawnWeight = 165; + static constexpr int nonPawnWeight = 159; workerThread.pawnCorrectionHistory[pawn_structure_index(pos)][us] - << bonus * 114 / 128; - workerThread.minorPieceCorrectionHistory[minor_piece_index(pos)][us] << bonus * 146 / 128; + << bonus * 104 / 128; + workerThread.minorPieceCorrectionHistory[minor_piece_index(pos)][us] << bonus * 145 / 128; workerThread.nonPawnCorrectionHistory[WHITE][non_pawn_index(pos)][us] << bonus * nonPawnWeight / 128; workerThread.nonPawnCorrectionHistory[BLACK][non_pawn_index(pos)][us] << bonus * nonPawnWeight / 128; if (m.is_ok()) - (*(ss - 2)->continuationCorrectionHistory)[pos.piece_on(m.to_sq())][m.to_sq()] << bonus; + (*(ss - 2)->continuationCorrectionHistory)[pos.piece_on(m.to_sq())][m.to_sq()] + << bonus * 146 / 128; } // History and stats update bonus, based on depth