diff --git a/src/misc.h b/src/misc.h index d69f7ef38..4ea7d99ac 100644 --- a/src/misc.h +++ b/src/misc.h @@ -373,6 +373,12 @@ inline uint64_t mul_hi64(uint64_t a, uint64_t b) { #endif } +template +inline constexpr T2 interpolate(T1 x, T1 x0, T1 x1, T2 y0, T2 y1) { + assert(x0 != x1); + return T2(y0 + (y1 - y0) * (x - x0) / (x1 - x0)); +} + uint64_t hash_bytes(const char*, size_t); template diff --git a/src/search.cpp b/src/search.cpp index 0214bf4d2..82f6c6750 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -511,7 +511,9 @@ bool Search::Worker::iterative_deepening() { double bestMoveInstability = 1.088 + 2.315 * totBestMoveChanges / threads.size(); - double highBestMoveEffort = nodesEffort > 86000 ? 0.74 : 0.96; + double highBestMoveEffort = std::clamp( + interpolate(int64_t(nodesEffort), int64_t(78000), int64_t(94000), 0.96, 0.74), 0.74, + 0.96); double totalTime = mainThread->tm.optimum() * fallingEval * reduction * bestMoveInstability * highBestMoveEffort;