Skip to content

Commit

Permalink
use current time instead of '1' for timeLeft formula.
Browse files Browse the repository at this point in the history
  • Loading branch information
TierynnB committed Feb 18, 2024
1 parent bf2c730 commit 8b67b7e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/timeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ void TimeManagement::init(Search::LimitsType& limits,
int mtg = limits.movestogo ? std::min(limits.movestogo, 50) : 50;

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

// x basetime (+ z increment)
// If there is a healthy increment, timeLeft can exceed actual available
// game time for the current move, so also cap to 20% of available game time.
if (limits.movestogo == 0)
{
Expand Down

0 comments on commit 8b67b7e

Please sign in to comment.