]> git.sesse.net Git - stockfish/commitdiff
Fix +M0 score when low on time
authorJoona Kiiski <joona.kiiski@gmail.com>
Sun, 19 Jan 2014 00:53:43 +0000 (08:53 +0800)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 19 Jan 2014 10:09:44 +0000 (11:09 +0100)
When time remaining is less than Emergency Move Time,
we won't even complete one iteration and engine reports
a stale +M0 score.

To reproduce run "go wtime 10"

info depth 1 seldepth 1 score mate 0 upperbound nodes 2 nps 500 time 4 multipv 1 pv a2a3
info nodes 2 time 4
bestmove a2a3 ponder (none)

This patch fixes the issue.

Tested by Binky at very short TC: 0.05+0.05
ELO: 5.96 +-12.9 (95%) LOS: 81.7%
Total: 1458 W: 394 L: 369 D: 695

And at a bit longer TC:
ELO: 1.56 +-3.7 (95%) LOS: 79.8%
Total: 16511 W: 3983 L: 3909 D: 8619

bench: 7804908

src/timeman.cpp

index 9f131d46d512d0ba6e4494ec81db724bd7698524..702f0f31eafb8f7d751552078bf12b18a889e6f9 100644 (file)
@@ -92,7 +92,7 @@ void TimeManager::init(const Search::LimitsType& limits, int currentPly, Color u
 
   // Initialize all to maximum values but unstablePVExtraTime that is reset
   unstablePVExtraTime = 0;
-  optimumSearchTime = maximumSearchTime = limits.time[us];
+  optimumSearchTime = maximumSearchTime = std::max(limits.time[us], minThinkingTime);
 
   // We calculate optimum time usage for different hypothetical "moves to go"-values and choose the
   // minimum of calculated search time values. Usually the greatest hypMTG gives the minimum values.