X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=a38bbff65a6eef38323da1a611cd56ff70e27ee1;hp=66b1d65dedf8c368f9c37a37ff43a178cf26d442;hb=c0616d773dcb967dad755de74c36937fc5753b63;hpb=87139d018c86211a0636cb1bcedf9572670d9ba6 diff --git a/src/search.cpp b/src/search.cpp index 66b1d65d..a38bbff6 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -38,6 +38,7 @@ #include "lock.h" #include "san.h" #include "search.h" +#include "timeman.h" #include "thread.h" #include "tt.h" #include "ucioption.h" @@ -473,32 +474,7 @@ bool think(const Position& pos, bool infinite, bool ponder, int time[], int incr int myIncrement = increment[pos.side_to_move()]; if (UseTimeManagement) { - if (!movesToGo) // Sudden death time control - { - if (myIncrement) - { - MaxSearchTime = myTime / 30 + myIncrement; - AbsoluteMaxSearchTime = Max(myTime / 4, myIncrement - 100); - } - else // Blitz game without increment - { - MaxSearchTime = myTime / 30; - AbsoluteMaxSearchTime = myTime / 8; - } - } - else // (x moves) / (y minutes) - { - if (movesToGo == 1) - { - MaxSearchTime = myTime / 2; - AbsoluteMaxSearchTime = (myTime > 3000)? (myTime - 500) : ((myTime * 3) / 4); - } - else - { - MaxSearchTime = myTime / Min(movesToGo, 20); - AbsoluteMaxSearchTime = Min((4 * myTime) / movesToGo, myTime / 3); - } - } + calc_search_times(myTime, myIncrement, movesToGo, pos.startpos_ply_counter(), MaxSearchTime, AbsoluteMaxSearchTime); if (get_option_value_bool("Ponder")) {