Simplify sudden death time optimization

Passed Sudden Death STC:
https://tests.stockfishchess.org/tests/view/68455fe5375c2b77d9855351
LLR: 2.91 (-2.94,2.94) <-1.75,0.25>
Total: 49248 W: 13008 L: 12798 D: 23442
Ptnml(0-2): 309, 5491, 12821, 5687, 316

Passed Sudden Death LTC:
https://tests.stockfishchess.org/tests/view/6845a392375c2b77d98553cf
LLR: 3.01 (-2.94,2.94) <-1.75,0.25>
Total: 551070 W: 141699 L: 142031 D: 267340
Ptnml(0-2): 1923, 60608, 150916, 60054, 2034

Passed Standard STC:
https://tests.stockfishchess.org/tests/view/683c5ebb6ec7634154f9d989
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 142624 W: 36808 L: 36709 D: 69107
Ptnml(0-2): 302, 15448, 39745, 15483, 334

Passed Standard LTC:
https://tests.stockfishchess.org/tests/view/683f1a4f6ec7634154f9dc5a
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 146922 W: 37381 L: 37296 D: 72245
Ptnml(0-2): 69, 13552, 46117, 13671, 52

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

Bench: 2249459
This commit is contained in:
FauziAkram
2025-06-14 16:10:59 +03:00
committed by Disservin
parent e695b9537e
commit ce73441f20

View File

@@ -85,16 +85,13 @@ void TimeManagement::init(Search::LimitsType& limits,
// with constants are involved. // with constants are involved.
const int64_t scaleFactor = useNodesTime ? npmsec : 1; const int64_t scaleFactor = useNodesTime ? npmsec : 1;
const TimePoint scaledTime = limits.time[us] / scaleFactor; const TimePoint scaledTime = limits.time[us] / scaleFactor;
const TimePoint scaledInc = limits.inc[us] / scaleFactor;
// Maximum move horizon // Maximum move horizon
int centiMTG = limits.movestogo ? std::min(limits.movestogo * 100, 5000) : 5051; int centiMTG = limits.movestogo ? std::min(limits.movestogo * 100, 5000) : 5051;
// If less than one second, gradually reduce mtg // If less than one second, gradually reduce mtg
if (scaledTime < 1000 && double(centiMTG) / scaledInc > 5.051) if (scaledTime < 1000)
{
centiMTG = scaledTime * 5.051; centiMTG = scaledTime * 5.051;
}
// Make sure timeLeft is > 0 since we may use it as a divisor // Make sure timeLeft is > 0 since we may use it as a divisor
TimePoint timeLeft = TimePoint timeLeft =