mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 09:13:08 +00:00
Do no initialize TM in all cases
Avoid doing full TM initialization if it won't be used, avoids division by zero. closes https://github.com/official-stockfish/Stockfish/pull/4484 No functional change
This commit is contained in:
parent
7a9f67747f
commit
1a64afb1c6
1 changed files with 6 additions and 2 deletions
|
@ -36,6 +36,12 @@ TimeManagement Time; // Our global time management object
|
||||||
|
|
||||||
void TimeManagement::init(Search::LimitsType& limits, Color us, int ply) {
|
void TimeManagement::init(Search::LimitsType& limits, Color us, int ply) {
|
||||||
|
|
||||||
|
// if we have no time, no need to initialize TM, except for the start time,
|
||||||
|
// which is used by movetime.
|
||||||
|
startTime = limits.startTime;
|
||||||
|
if (limits.time[us] == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
TimePoint moveOverhead = TimePoint(Options["Move Overhead"]);
|
TimePoint moveOverhead = TimePoint(Options["Move Overhead"]);
|
||||||
TimePoint slowMover = TimePoint(Options["Slow Mover"]);
|
TimePoint slowMover = TimePoint(Options["Slow Mover"]);
|
||||||
TimePoint npmsec = TimePoint(Options["nodestime"]);
|
TimePoint npmsec = TimePoint(Options["nodestime"]);
|
||||||
|
@ -59,8 +65,6 @@ void TimeManagement::init(Search::LimitsType& limits, Color us, int ply) {
|
||||||
limits.npmsec = npmsec;
|
limits.npmsec = npmsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
startTime = limits.startTime;
|
|
||||||
|
|
||||||
// Maximum move horizon of 50 moves
|
// Maximum move horizon of 50 moves
|
||||||
int mtg = limits.movestogo ? std::min(limits.movestogo, 50) : 50;
|
int mtg = limits.movestogo ? std::min(limits.movestogo, 50) : 50;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue