Increase full depth search reduction when cutNode

In addition to the core patch, improve the use of `isTTMove`:

- this name was used to mean both `bestMove == ttData.move` and `move == ttData.move`, so i replaced the argument `isTTMove` of `update_all_stats` with `TTMove` directly.

- `ttData.move == move` was  still used in some places instead of `ss->isTTMove`. I replaced these to be more consistent.

Passed STC:
https://tests.stockfishchess.org/tests/view/68057b8f98cd372e3aea3472
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 38400 W: 10048 L: 9734 D: 18618
Ptnml(0-2): 102, 4360, 9956, 4686, 96

Passed LTC:
https://tests.stockfishchess.org/tests/view/68057f7c98cd372e3aea3842
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 312666 W: 79494 L: 78616 D: 154556
Ptnml(0-2): 144, 33809, 87563, 34659, 158

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

Bench: 1623376
This commit is contained in:
Nonlinear2
2025-04-21 15:13:30 +02:00
committed by Joost VandeVondele
parent 88a524c552
commit 0dcfe096d6

View File

@@ -164,7 +164,7 @@ void update_all_stats(const Position& pos,
ValueList<Move, 32>& quietsSearched,
ValueList<Move, 32>& capturesSearched,
Depth depth,
bool isTTMove,
Move TTMove,
int moveCount);
} // namespace
@@ -1098,8 +1098,9 @@ moves_loop: // When in check, search starts here
lmrDepth += history / 3593;
Value futilityValue = ss->staticEval + (bestMove ? 48 : 146) + 116 * lmrDepth
+ 103 * (bestValue < ss->staticEval - 128 && ss->staticEval > alpha - 50);
Value futilityValue =
ss->staticEval + (bestMove ? 48 : 146) + 116 * lmrDepth
+ 103 * (bestValue < ss->staticEval - 128 && ss->staticEval > alpha - 50);
// Futility pruning: parent node
// (*Scaler): Generally, more frequent futility pruning
@@ -1231,7 +1232,7 @@ moves_loop: // When in check, search starts here
r += 1042 + allNode * 864;
// For first picked move (ttMove) reduce reduction
else if (move == ttData.move)
else if (ss->isTTMove)
r -= 1937;
if (capture)
@@ -1302,6 +1303,9 @@ moves_loop: // When in check, search starts here
r -= ttMoveHistory / 8;
if (cutNode)
r += 520;
// Note that if expected reduction is high, we reduce search depth here
value = -search<NonPV>(pos, ss + 1, -(alpha + 1), -alpha,
newDepth - (r > 3495) - (r > 5510 && newDepth > 2), !cutNode);
@@ -1315,7 +1319,7 @@ moves_loop: // When in check, search starts here
(ss + 1)->pv[0] = Move::none();
// Extend move from transposition table if we are about to dive into qsearch.
if (move == ttData.move && thisThread->rootDepth > 8)
if (ss->isTTMove && thisThread->rootDepth > 8)
newDepth = std::max(newDepth, 1);
value = -search<PV>(pos, ss + 1, -beta, -alpha, newDepth, false);
@@ -1450,10 +1454,10 @@ moves_loop: // When in check, search starts here
else if (bestMove)
{
update_all_stats(pos, ss, *this, bestMove, prevSq, quietsSearched, capturesSearched, depth,
bestMove == ttData.move, moveCount);
ttData.move, moveCount);
if (!PvNode)
{
int bonus = (ttData.move == move) ? 800 : -870;
int bonus = ss->isTTMove ? 800 : -870;
ttMoveHistory << bonus;
}
}
@@ -1877,14 +1881,14 @@ void update_all_stats(const Position& pos,
ValueList<Move, 32>& quietsSearched,
ValueList<Move, 32>& capturesSearched,
Depth depth,
bool isTTMove,
Move TTMove,
int moveCount) {
CapturePieceToHistory& captureHistory = workerThread.captureHistory;
Piece moved_piece = pos.moved_piece(bestMove);
PieceType captured;
int bonus = std::min(141 * depth - 89, 1613) + 311 * isTTMove;
int bonus = std::min(141 * depth - 89, 1613) + 311 * (bestMove == TTMove);
int malus = std::min(695 * depth - 215, 2808) - 31 * (moveCount - 1);
if (!pos.capture_stage(bestMove))