From 7315001f37e85f4405d5593be85a22975df6d33d Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sat, 1 Jan 2011 13:48:08 +0100 Subject: [PATCH] Simplify "ponderhit" handling If flag StopOnPonderhit is set it means that we UseTimeManagement and also we are at Iteration >= 3. So we can safely simplify the formula. No functional change. Signed-off-by: Marco Costalba --- src/search.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index a73e1b80..93f20800 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1973,13 +1973,6 @@ split_point_start: // At split points actual search starts from here static int lastInfoTime; int t = current_search_time(); - bool stillAtFirstMove = FirstRootMove - && !AspirationFailLow - && t > TimeMgr.available_time(); - - bool noMoreTime = t > TimeMgr.maximum_time() - || stillAtFirstMove; - // Poll for input if (data_available()) { @@ -2010,8 +2003,7 @@ split_point_start: // At split points actual search starts from here // should continue searching but switching from pondering to normal search. Pondering = false; - if ( Iteration >= 3 && UseTimeManagement - && (noMoreTime || StopOnPonderhit)) + if (StopOnPonderhit) StopRequest = true; } } @@ -2043,6 +2035,13 @@ split_point_start: // At split points actual search starts from here if (Pondering) return; + bool stillAtFirstMove = FirstRootMove + && !AspirationFailLow + && t > TimeMgr.available_time(); + + bool noMoreTime = t > TimeMgr.maximum_time() + || stillAtFirstMove; + if ( (Iteration >= 3 && UseTimeManagement && noMoreTime) || (ExactMaxTime && t >= ExactMaxTime) || (Iteration >= 3 && MaxNodes && pos.nodes_searched() >= MaxNodes)) -- 2.39.2