X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftimeman.cpp;h=edbc34e42b5cba142804c62e20f9ec9a7a65f50d;hp=e29d4e467fec7a9f3f4f8e34983b9d210e323959;hb=d58176bfead421088bb3543b3cb6d1c359a3c91b;hpb=ff41b8df764b352b450af572fa98097343b3f808 diff --git a/src/timeman.cpp b/src/timeman.cpp index e29d4e46..edbc34e4 100644 --- a/src/timeman.cpp +++ b/src/timeman.cpp @@ -18,6 +18,7 @@ */ #include +#include #include "misc.h" #include "search.h" @@ -64,7 +65,7 @@ namespace { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1 }; - int move_importance(int ply) { return MoveImportance[Min(ply, 511)]; } + int move_importance(int ply) { return MoveImportance[std::min(ply, 511)]; } /// Function Prototypes @@ -78,8 +79,8 @@ namespace { void TimeManager::pv_instability(int curChanges, int prevChanges) { - unstablePVExtraTime = curChanges * (optimumSearchTime / 2) - + prevChanges * (optimumSearchTime / 3); + unstablePVExtraTime = curChanges * (optimumSearchTime / 2) + + prevChanges * (optimumSearchTime / 3); } @@ -114,28 +115,28 @@ void TimeManager::init(const SearchLimits& limits, int currentPly) // We calculate optimum time usage for different hypothetic "moves to go"-values and choose the // minimum of calculated search time values. Usually the greatest hypMTG gives the minimum values. - for (hypMTG = 1; hypMTG <= (limits.movesToGo ? Min(limits.movesToGo, MoveHorizon) : MoveHorizon); hypMTG++) + for (hypMTG = 1; hypMTG <= (limits.movesToGo ? std::min(limits.movesToGo, MoveHorizon) : MoveHorizon); hypMTG++) { // Calculate thinking time for hypothetic "moves to go"-value hypMyTime = limits.time + limits.increment * (hypMTG - 1) - emergencyBaseTime - - emergencyMoveTime * Min(hypMTG, emergencyMoveHorizon); + - emergencyMoveTime * std::min(hypMTG, emergencyMoveHorizon); - hypMyTime = Max(hypMyTime, 0); + hypMyTime = std::max(hypMyTime, 0); t1 = minThinkingTime + remaining(hypMyTime, hypMTG, currentPly); t2 = minThinkingTime + remaining(hypMyTime, hypMTG, currentPly); - optimumSearchTime = Min(optimumSearchTime, t1); - maximumSearchTime = Min(maximumSearchTime, t2); + optimumSearchTime = std::min(optimumSearchTime, t1); + maximumSearchTime = std::min(maximumSearchTime, t2); } if (Options["Ponder"].value()) optimumSearchTime += optimumSearchTime / 4; // Make sure that maxSearchTime is not over absoluteMaxSearchTime - optimumSearchTime = Min(optimumSearchTime, maximumSearchTime); + optimumSearchTime = std::min(optimumSearchTime, maximumSearchTime); } @@ -156,6 +157,6 @@ namespace { float ratio1 = (TMaxRatio * thisMoveImportance) / float(TMaxRatio * thisMoveImportance + otherMovesImportance); float ratio2 = (thisMoveImportance + TStealRatio * otherMovesImportance) / float(thisMoveImportance + otherMovesImportance); - return int(floor(myTime * Min(ratio1, ratio2))); + return int(floor(myTime * std::min(ratio1, ratio2))); } }