Minor code improvements

- Remove / add empty lines
- fix the `ttcapture` comment
- remove the `bonus` variable for `ttMoveHistory`
- remove unnecessary parentheses / brackets
- refactor the movepick good quiet stage
- rename `endMoves` to `endCur`, as the previous name suggests that it points to the end of all generated moves, which it does not.

closes https://github.com/official-stockfish/Stockfish/pull/6089

No functional change.

Co-Authored-By: xu-shawn <50402888+xu-shawn@users.noreply.github.com>
This commit is contained in:
Nonlinear2
2025-05-25 20:59:27 +02:00
committed by Joost VandeVondele
co-authored by xu-shawn
parent f58d923fe0
commit b1b5893a8e
3 changed files with 25 additions and 27 deletions
+5 -10
View File
@@ -680,8 +680,6 @@ Value Search::Worker::search(
&& (ttData.bound & (ttData.value >= beta ? BOUND_LOWER : BOUND_UPPER))
&& (cutNode == (ttData.value >= beta) || depth > 5))
{
// If ttMove is quiet, update move sorting heuristics on TT hit
if (ttData.move && ttData.value >= beta)
{
@@ -712,15 +710,15 @@ Value Search::Worker::search(
if (!is_valid(ttDataNext.value))
return ttData.value;
if (ttData.value >= beta && -ttDataNext.value >= beta)
return ttData.value;
if (ttData.value <= alpha && -ttDataNext.value <= alpha)
return ttData.value;
}
else
{
return ttData.value;
}
}
}
@@ -1215,7 +1213,7 @@ moves_loop: // When in check, search starts here
if (cutNode)
r += 2864 + 966 * !ttData.move;
// Increase reduction if ttMove is a capture but the current move is not a capture
// Increase reduction if ttMove is a capture
if (ttCapture)
r += 1210 + (depth < 8) * 963;
@@ -1253,7 +1251,7 @@ moves_loop: // When in check, search starts here
// std::clamp has been replaced by a more robust implementation.
Depth d = std::max(1, std::min(newDepth - r / 1024,
newDepth + !allNode + (PvNode && !bestMove)))
+ ((ss - 1)->isPvNode);
+ (ss - 1)->isPvNode;
ss->reduction = newDepth - d;
value = -search<NonPV>(pos, ss + 1, -(alpha + 1), -alpha, d, true);
@@ -1440,10 +1438,7 @@ moves_loop: // When in check, search starts here
update_all_stats(pos, ss, *this, bestMove, prevSq, quietsSearched, capturesSearched, depth,
ttData.move, moveCount);
if (!PvNode)
{
int bonus = bestMove == ttData.move ? 800 : -879;
ttMoveHistory << bonus;
}
ttMoveHistory << (bestMove == ttData.move ? 800 : -879);
}
// Bonus for prior quiet countermove that caused the fail low