Skip to content

Commit

Permalink
Rewrite of 'Adjust correction history' condition
Browse files Browse the repository at this point in the history
Current condition is convoluted and hard to understand because of
several negations. Also added 2 comments to make the concept behind the
condition better understandable.

No functional change
  • Loading branch information
pb00068 authored and PikaCat-OuO committed Nov 23, 2024
1 parent eee674b commit d11501e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,9 @@ Value Search::Worker::search(
depth, bestMove, unadjustedStaticEval, tt.generation());

// Adjust correction history
if (!ss->inCheck && (!bestMove || !pos.capture(bestMove))
&& !(bestValue >= beta && bestValue <= ss->staticEval)
&& !(!bestMove && bestValue >= ss->staticEval))
if (!ss->inCheck && !(bestMove && pos.capture(bestMove))
&& ((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;

Expand Down

0 comments on commit d11501e

Please sign in to comment.