From d46d5953a7458a1159ba2cb283feb89c8101f241 Mon Sep 17 00:00:00 2001 From: rektdie Date: Thu, 27 Mar 2025 21:46:00 +0100 Subject: [PATCH] minimum search time is 4ms | bench 684523 --- source/search.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/search.cpp b/source/search.cpp index d8a8e24..9b9fafb 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -313,8 +313,6 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) { // Iterative deepening static SearchResults ID(Board &board, SearchParams params) { - sw.Restart(); - int fullTime = board.sideToMove ? params.btime : params.wtime; int inc = board.sideToMove ? params.binc : params.winc; @@ -328,11 +326,15 @@ static SearchResults ID(Board &board, SearchParams params) { int ply = 0; + int elapsed = 0; + sw.Restart(); + for (int depth = 1; depth <= 99; depth++) { - timeToSearch = (fullTime / 20) + (inc / 2); + timeToSearch = std::max((fullTime / 20) + (inc / 2), 4); int softTime = timeToSearch * 0.65; SearchResults currentResults = PVS(board, depth, alpha, beta, ply); + elapsed = sw.GetElapsedMS(); // If we fell outside the window, try again with full width if ((currentResults.score <= alpha) @@ -361,6 +363,7 @@ static SearchResults ID(Board &board, SearchParams params) { std::cout << "info "; std::cout << "depth " << depth; + std::cout << " time " << elapsed; std::cout << " score cp " << safeResults.score; std::cout << " nodes " << nodes << " nps " << int(nodes/sw.GetElapsedSec()); std::cout << " hashfull " << TT.GetUsedPercentage();