X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftimeman.cpp;h=86e6729cd1fcf087ce6faf1402240b7364eeb80f;hp=046b3aaf70c769e03adcd7668445399eabeeebf7;hb=8d4caebabe91a473bd052d2f771e79a184902c31;hpb=c295599e4ad481f677b14cb0be14174b61ebff81 diff --git a/src/timeman.cpp b/src/timeman.cpp index 046b3aaf..86e6729c 100644 --- a/src/timeman.cpp +++ b/src/timeman.cpp @@ -88,13 +88,13 @@ namespace { //// Functions //// -void TimeManager::best_move_changes(int curIter, int prevIter) { +void TimeManager::pv_instability(int curChanges, int prevChanges) { - extraSearchTime = curIter * (optimumSearchTime / 2) - + prevIter * (optimumSearchTime / 3); + unstablePVExtraTime = curChanges * (optimumSearchTime / 2) + + prevChanges * (optimumSearchTime / 3); } -void TimeManager::update(int myTime, int myInc, int movesToGo, int currentPly) +void TimeManager::init(int myTime, int myInc, int movesToGo, int currentPly) { /* We support four different kind of time controls: @@ -114,12 +114,13 @@ void TimeManager::update(int myTime, int myInc, int movesToGo, int currentPly) int hypMTG, hypMyTime, t1, t2; // Read uci parameters - int emergencyMoveHorizon = get_option_value_int("Emergency Move Horizon"); - int emergencyBaseTime = get_option_value_int("Emergency Base Time"); - int emergencyMoveTime = get_option_value_int("Emergency Move Time"); - int minThinkingTime = get_option_value_int("Minimum Thinking Time"); + int emergencyMoveHorizon = Options["Emergency Move Horizon"].value(); + int emergencyBaseTime = Options["Emergency Base Time"].value(); + int emergencyMoveTime = Options["Emergency Move Time"].value(); + int minThinkingTime = Options["Minimum Thinking Time"].value(); - // Initialize variables to maximum values + // Initialize to maximum values but unstablePVExtraTime that is reset + unstablePVExtraTime = 0; optimumSearchTime = maximumSearchTime = myTime; // We calculate optimum time usage for different hypothetic "moves to go"-values and choose the @@ -136,7 +137,7 @@ void TimeManager::update(int myTime, int myInc, int movesToGo, int currentPly) maximumSearchTime = Min(maximumSearchTime, t2); } - if (get_option_value_bool("Ponder")) + if (Options["Ponder"].value()) optimumSearchTime += optimumSearchTime / 4; // Make sure that maxSearchTime is not over absoluteMaxSearchTime