Skip to content

Commit de4a3c4

Browse files
committed
make timeLeft a double, timepoint seemed unecessary since it was always casting back to double anyway.
1 parent e1f6b87 commit de4a3c4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/timeman.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ void TimeManagement::init(Search::LimitsType& limits,
8484
// Maximum move horizon of 50 moves
8585
int mtg = limits.movestogo ? std::min(limits.movestogo, 50) : 50;
8686

87-
// Make sure timeLeft is > 0 since we may use it as a divisor
87+
// Make sure timeLeft is > 0 since we use it as a divisor
8888
// If there is a healthy increment and low mtg, timeLeft can exceed actual available
89-
TimePoint timeLeft = std::max(limits.time[us], limits.time[us] + limits.inc[us] * (mtg - 1)
90-
- moveOverhead * (2 + mtg));
89+
double timeLeft =
90+
std::max(limits.time[us], limits.time[us] + limits.inc[us] * (mtg - 1) - moveOverhead * mtg);
9191

9292
// x basetime (+ z increment)
9393
// game time for the current move, so also cap to 20% of available game time.
@@ -102,15 +102,15 @@ void TimeManagement::init(Search::LimitsType& limits,
102102
double maxConstant = std::max(3.4 + 3.0 * std::log10(limits.time[us] / 1000.0), 2.76);
103103

104104
optScale = std::min(0.0120 + std::pow(ply + 3.1, 0.44) * optConstant,
105-
0.21 * limits.time[us] / double(timeLeft))
105+
0.21 * limits.time[us] / timeLeft)
106106
* optExtra;
107107
maxScale = std::min(6.9, maxConstant + ply / 12.2);
108108
}
109109

110110
// x moves in y seconds (+ z increment)
111111
else
112112
{
113-
optScale = std::min((0.88 + ply / 116.4) / mtg, 0.88 * limits.time[us] / double(timeLeft));
113+
optScale = std::min((0.88 + ply / 116.4) / mtg, 0.88 * limits.time[us] / timeLeft);
114114
maxScale = std::min(6.3, 1.5 + 0.11 * mtg);
115115
}
116116

0 commit comments

Comments
 (0)