1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00

Range reductions

adding reductions for when the delta between the static eval and the child's eval is consistently low.

passed STC
https://tests.stockfishchess.org/html/live_elo.html?614d7b3c7bdc23e77ceb8a5d
LLR: 2.95 (-2.94,2.94) <-0.50,2.50>
Total: 88872 W: 22672 L: 22366 D: 43834
Ptnml(0-2): 343, 10150, 23117, 10510, 316

passed LTC
https://tests.stockfishchess.org/html/live_elo.html?614daf3e7bdc23e77ceb8a82
LLR: 2.93 (-2.94,2.94) <0.50,3.50>
Total: 24368 W: 6153 L: 5928 D: 12287
Ptnml(0-2): 13, 2503, 6937, 2708, 23

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

Bench: 5443950
This commit is contained in:
OfekShochat 2021-09-23 23:16:17 +03:00 committed by Joost VandeVondele
parent ff3fa0c664
commit 00e34a758f
2 changed files with 10 additions and 4 deletions

View file

@ -143,6 +143,7 @@ Nikolay Kostov (NikolayIT)
Nguyen Pham (nguyenpham) Nguyen Pham (nguyenpham)
Norman Schmidt (FireFather) Norman Schmidt (FireFather)
notruck notruck
Ofek Shochat (OfekShochat, ghostway)
Ondrej Mosnáček (WOnder93) Ondrej Mosnáček (WOnder93)
Oskar Werkelin Ahlin Oskar Werkelin Ahlin
Pablo Vazquez Pablo Vazquez

View file

@ -69,9 +69,9 @@ namespace {
// Reductions lookup table, initialized at startup // Reductions lookup table, initialized at startup
int Reductions[MAX_MOVES]; // [depth or moveNumber] int Reductions[MAX_MOVES]; // [depth or moveNumber]
Depth reduction(bool i, Depth d, int mn) { Depth reduction(bool i, Depth d, int mn, bool rangeReduction) {
int r = Reductions[d] * Reductions[mn]; int r = Reductions[d] * Reductions[mn];
return (r + 534) / 1024 + (!i && r > 904); return (r + 534) / 1024 + (!i && r > 904) + rangeReduction;
} }
constexpr int futility_move_count(bool improving, Depth depth) { constexpr int futility_move_count(bool improving, Depth depth) {
@ -954,6 +954,7 @@ namespace {
moves_loop: // When in check, search starts here moves_loop: // When in check, search starts here
ttCapture = ttMove && pos.capture_or_promotion(ttMove); ttCapture = ttMove && pos.capture_or_promotion(ttMove);
int rangeReduction = 0;
// Step 11. A small Probcut idea, when we are in check // Step 11. A small Probcut idea, when we are in check
probCutBeta = beta + 409; probCutBeta = beta + 409;
@ -1041,7 +1042,7 @@ moves_loop: // When in check, search starts here
moveCountPruning = moveCount >= futility_move_count(improving, depth); moveCountPruning = moveCount >= futility_move_count(improving, depth);
// Reduced depth of the next LMR search // Reduced depth of the next LMR search
int lmrDepth = std::max(newDepth - reduction(improving, depth, moveCount), 0); int lmrDepth = std::max(newDepth - reduction(improving, depth, moveCount, rangeReduction > 2), 0);
if ( captureOrPromotion if ( captureOrPromotion
|| givesCheck) || givesCheck)
@ -1176,7 +1177,7 @@ moves_loop: // When in check, search starts here
|| !ss->ttPv) || !ss->ttPv)
&& (!PvNode || ss->ply > 1 || thisThread->id() % 4 != 3)) && (!PvNode || ss->ply > 1 || thisThread->id() % 4 != 3))
{ {
Depth r = reduction(improving, depth, moveCount); Depth r = reduction(improving, depth, moveCount, rangeReduction > 2);
if (PvNode) if (PvNode)
r--; r--;
@ -1236,6 +1237,10 @@ moves_loop: // When in check, search starts here
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d, true); value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d, true);
// Range reductions (~3 Elo)
if (ss->staticEval - value < 30 && depth > 7)
rangeReduction++;
// If the son is reduced and fails high it will be re-searched at full depth // If the son is reduced and fails high it will be re-searched at full depth
doFullDepthSearch = value > alpha && d < newDepth; doFullDepthSearch = value > alpha && d < newDepth;
didLMR = true; didLMR = true;