]> git.sesse.net Git - stockfish/commitdiff
Simplify away some unneeded code in time management
authorMichael Chaly <Vizvezdenec@gmail.com>
Wed, 13 Jul 2022 08:59:54 +0000 (11:59 +0300)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Wed, 13 Jul 2022 16:00:39 +0000 (18:00 +0200)
The lower bound of the clamp is never used since complexity can't be negative and thus is unneeded.

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

No functional change

src/search.cpp

index ca1d2632b531a628a8b105340982b3281d7394c0..c5c7f111e8803ee1f4330fa1b7e32b3d5037fb3e 100644 (file)
@@ -474,7 +474,7 @@ void Thread::search() {
           double reduction = (1.56 + mainThread->previousTimeReduction) / (2.20 * timeReduction);
           double bestMoveInstability = 1 + 1.7 * totBestMoveChanges / Threads.size();
           int complexity = mainThread->complexityAverage.value();
-          double complexPosition = std::clamp(1.0 + (complexity - 277) / 1819.1, 0.5, 1.5);
+          double complexPosition = std::min(1.0 + (complexity - 277) / 1819.1, 1.5);
 
           double totalTime = Time.optimum() * fallingEval * reduction * bestMoveInstability * complexPosition;