X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=6090233089bdcacd7d1f514507925e029e4730cf;hp=6ef15600d70604708b65847f8739c1281ec070a6;hb=9429d2d028f91863c63b0072b64cc9da99823017;hpb=e738fa7d10a24ab41fa2389be1660cb4204573f4 diff --git a/src/search.cpp b/src/search.cpp index 6ef15600..60902330 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -198,7 +198,7 @@ namespace { int MaxSearchTime, AbsoluteMaxSearchTime, ExtraSearchTime, ExactMaxTime; bool UseTimeManagement, InfiniteSearch, PonderSearch, StopOnPonderhit; bool AbortSearch, Quit; - bool FailLow; + bool AspirationFailLow; // Show current line? bool ShowCurrentLine; @@ -340,7 +340,7 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move, // Initialize global search variables Idle = StopOnPonderhit = AbortSearch = Quit = false; - FailLow = false; + AspirationFailLow = false; NodesSincePoll = 0; SearchStartTime = get_system_time(); ExactMaxTime = maxTime; @@ -351,7 +351,7 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move, UseTimeManagement = !ExactMaxTime && !MaxDepth && !MaxNodes && !InfiniteSearch; // Look for a book move, only during games, not tests - if (UseTimeManagement && !ponder && get_option_value_bool("OwnBook")) + if (UseTimeManagement && get_option_value_bool("OwnBook")) { Move bookMove; if (get_option_value_string("Book File") != OpeningBook.file_name()) @@ -360,6 +360,9 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move, bookMove = OpeningBook.get_move(pos); if (bookMove != MOVE_NONE) { + if (PonderSearch) + wait_for_stop_or_ponderhit(); + cout << "bestmove " << bookMove << endl; return true; } @@ -1078,9 +1081,9 @@ namespace { assert(alpha >= oldAlpha); - FailLow = (alpha == oldAlpha); + AspirationFailLow = (alpha == oldAlpha); - if (FailLow && StopOnPonderhit) + if (AspirationFailLow && StopOnPonderhit) StopOnPonderhit = false; } @@ -1470,7 +1473,7 @@ namespace { { search(pos, ss, beta, Min(depth/2, depth-2*OnePly), ply, false, threadID); ttMove = ss[ply].pv[ply]; - tte = TT.retrieve(pos.get_key()); + tte = TT.retrieve(posKey); } // Initialize a MovePicker object for the current position, and prepare @@ -2683,7 +2686,7 @@ namespace { return; bool stillAtFirstMove = RootMoveNumber == 1 - && !FailLow + && !AspirationFailLow && t > MaxSearchTime + ExtraSearchTime; bool noMoreTime = t > AbsoluteMaxSearchTime @@ -2706,7 +2709,7 @@ namespace { PonderSearch = false; bool stillAtFirstMove = RootMoveNumber == 1 - && !FailLow + && !AspirationFailLow && t > MaxSearchTime + ExtraSearchTime; bool noMoreTime = t > AbsoluteMaxSearchTime @@ -3026,7 +3029,7 @@ namespace { for (int i = 0; i < ActiveThreads; i++) if (i == master || splitPoint->slaves[i]) { - memcpy(splitPoint->sstack[i] + ply - 1, sstck + ply - 1, 3 * sizeof(SearchStack)); + memcpy(splitPoint->sstack[i] + ply - 1, sstck + ply - 1, 4 * sizeof(SearchStack)); Threads[i].workIsWaiting = true; // This makes the slave to exit from idle_loop() }