Skip to content

Commit

Permalink
Same weight for black and white nonPawnCorrection history
Browse files Browse the repository at this point in the 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 (128 and 150) with just one value 139 (= the avg of the two).
  • Loading branch information
pb00067 authored and PikaCat-OuO committed Dec 24, 2024
1 parent 53839fd commit 8c29bba
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,8 @@ Value Search::Worker::search(
&& ((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 = 139;

auto bonus = std::clamp(int(bestValue - ss->staticEval) * depth / 8,
-CORRECTION_HISTORY_LIMIT / 4, CORRECTION_HISTORY_LIMIT / 4);
Expand All @@ -1349,9 +1350,9 @@ Value Search::Worker::search(
thisThread->majorPieceCorrectionHistory[us][major_piece_index(pos)] << bonus * 185 / 128;
thisThread->minorPieceCorrectionHistory[us][minor_piece_index(pos)] << bonus * 101 / 128;
thisThread->nonPawnCorrectionHistory[WHITE][us][non_pawn_index<WHITE>(pos)]
<< bonus * 128 / 128;
<< bonus * nonPawnWeight / 128;
thisThread->nonPawnCorrectionHistory[BLACK][us][non_pawn_index<BLACK>(pos)]
<< bonus * 150 / 128;
<< bonus * nonPawnWeight / 128;

if (m.is_ok())
(*(ss - 2)->continuationCorrectionHistory)[pos.piece_on(m.to_sq())][m.to_sq()] << bonus;
Expand Down

0 comments on commit 8c29bba

Please sign in to comment.