X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fsearch.cpp;h=c9d5da64c2f8efa0e6602f3c6f2cc28cafeb038a;hb=2b0372319d2a6797c49cb24dca5da221a669e36a;hp=c81496d17a35aa6a00374c9ec9be9115ea720c49;hpb=d11101e4c6cd6aafca06e07d24e1c7026c92f6e7;p=stockfish diff --git a/src/search.cpp b/src/search.cpp index c81496d1..c9d5da64 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -329,6 +329,7 @@ void Thread::search() { doubleExtensionAverage[WHITE].set(0, 100); // initialize the running average at 0% doubleExtensionAverage[BLACK].set(0, 100); // initialize the running average at 0% + complexityAverage.set(232, 1); nodesLastExplosive = nodes; nodesLastNormal = nodes; @@ -496,7 +497,10 @@ void Thread::search() { double reduction = (1.47 + mainThread->previousTimeReduction) / (2.32 * timeReduction); double bestMoveInstability = 1.073 + std::max(1.0, 2.25 - 9.9 / rootDepth) * totBestMoveChanges / Threads.size(); - double totalTime = Time.optimum() * fallingEval * reduction * bestMoveInstability; + int complexity = mainThread->complexityAverage.value(); + double complexPosition = std::clamp(1.0 + (complexity - 232) / 1750.0, 0.5, 1.5); + + double totalTime = Time.optimum() * fallingEval * reduction * bestMoveInstability * complexPosition; // Cap used time in case of a single legal move for a better viewer experience in tournaments // yielding correct scores and sufficiently fast moves. @@ -806,6 +810,8 @@ namespace { improving = improvement > 0; complexity = abs(ss->staticEval - (us == WHITE ? eg_value(pos.psq_score()) : -eg_value(pos.psq_score()))); + thisThread->complexityAverage.update(complexity); + // Step 7. Futility pruning: child node (~25 Elo). // The depth condition is important for mate finding. if ( !ss->ttPv