bool is_greater(int64_t a, int64_t b)
{ return b * average > a * PERIOD * RESOLUTION ; }
+ int64_t value()
+ { return average / (PERIOD * RESOLUTION); }
+
private :
static constexpr int64_t PERIOD = 4096;
static constexpr int64_t RESOLUTION = 1024;
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;
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.
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
Material::Table materialTable;
size_t pvIdx, pvLast;
RunningAverage doubleExtensionAverage[COLOR_NB];
+ RunningAverage complexityAverage;
uint64_t nodesLastExplosive;
uint64_t nodesLastNormal;
std::atomic<uint64_t> nodes, tbHits, bestMoveChanges;