Simplify and cleanup futility pruning for child nodes

This patch removes (eval - beta) / 8 addition and adjusts constants
accordingly, also moves every calculation into futility_margin function.

Passed STC:
https://tests.stockfishchess.org/tests/view/6806d00f878abf56f9a0d524
LLR: 2.99 (-2.94,2.94) <-1.75,0.25>
Total: 483456 W: 124592 L: 124860 D: 234004
Ptnml(0-2): 1419, 57640, 123927, 57274, 1468

Passed LTC:
https://tests.stockfishchess.org/tests/view/680cceb33629b02d74b1554c
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 263868 W: 67076 L: 67104 D: 129688
Ptnml(0-2): 155, 28893, 73846, 28905, 135

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

bench: 1618439
This commit is contained in:
Michael Chaly
2025-04-26 19:36:08 +03:00
committed by Joost VandeVondele
parent 7e6a0c464b
commit 4b58079485

View File

@@ -71,12 +71,20 @@ namespace {
// tests at these types of time controls.
// Futility margin
Value futility_margin(Depth d, bool noTtCutNode, bool improving, bool oppWorsening) {
Value futilityMult = 110 - 25 * noTtCutNode;
Value futility_margin(Depth d,
bool noTtCutNode,
bool improving,
bool oppWorsening,
int statScore,
int correctionValue) {
Value futilityMult = 98 - 22 * noTtCutNode;
Value improvingDeduction = improving * futilityMult * 2;
Value worseningDeduction = oppWorsening * futilityMult / 3;
Value statScoreAddition = statScore / 339;
Value correctionAddition = correctionValue / 157363;
return futilityMult * d - improvingDeduction - worseningDeduction;
return futilityMult * d - improvingDeduction - worseningDeduction + statScoreAddition
+ correctionAddition;
}
constexpr int futility_move_count(bool improving, Depth depth) {
@@ -866,9 +874,9 @@ Value Search::Worker::search(
// Step 8. Futility pruning: child node
// The depth condition is important for mate finding.
if (!ss->ttPv && depth < 14
&& eval - futility_margin(depth, cutNode && !ss->ttHit, improving, opponentWorsening)
- (ss - 1)->statScore / 301 + 37 + ((eval - beta) / 8)
- std::abs(correctionValue) / 139878
&& eval
- futility_margin(depth, cutNode && !ss->ttHit, improving, opponentWorsening,
(ss - 1)->statScore, std::abs(correctionValue))
>= beta
&& eval >= beta && (!ttData.move || ttCapture) && !is_loss(beta) && !is_win(eval))
return beta + (eval - beta) / 3;