X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=6aa13a5e84573ecfb6a3c5c1ecdecface8e72e67;hp=b8d6a3a58ef7d3f6f953eca5f0665cec2a1b0cc6;hb=6f28bcd483647e9ea1e7da629ed900fd254430ca;hpb=acef5d6a594900009d20524140a6f410cf1e4a0c diff --git a/src/search.cpp b/src/search.cpp index b8d6a3a5..6aa13a5e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -891,7 +891,7 @@ namespace { Value root_search(Position &pos, SearchStack ss[], RootMoveList &rml, Value alpha, Value beta) { - //FIXME: Implement bestValue + Value bestValue = -VALUE_INFINITE; Value oldAlpha = alpha; Value value; Bitboard dcCandidates = pos.discovered_check_candidates(pos.side_to_move()); @@ -899,7 +899,7 @@ namespace { // Loop through all the moves in the root move list for (int i = 0; i < rml.move_count() && !AbortSearch; i++) { - if (alpha >= beta) { + if (alpha >= beta) { //Aspiration window failed high, ignore rest of the moves! rml.set_move_score(i, -VALUE_INFINITE); //Leave node-counters and beta-counters as they are. continue; @@ -982,7 +982,7 @@ namespace { assert(value >= -VALUE_INFINITE && value <= VALUE_INFINITE); - if (value <= alpha && i >= MultiPV) + if (value <= bestValue && i >= MultiPV) rml.set_move_score(i, -VALUE_INFINITE); else { @@ -1018,8 +1018,12 @@ namespace { LogFile << pretty_pv(pos, current_search_time(), Iteration, nodes_searched(), value, ss[0].pv) << std::endl; - if (value > alpha) - alpha = value; + if (value > bestValue) + { + bestValue = value; + if (value > alpha) + alpha = value; + } // Reset the global variable Problem to false if the value isn't too // far below the final value from the last iteration. @@ -1046,16 +1050,17 @@ namespace { std::cout << std::endl; } alpha = rml.get_move_score(Min(i, MultiPV-1)); + bestValue = alpha; //In MultiPV-mode bestValue and alpha are always same thing. } } - if (alpha <= oldAlpha) + if (bestValue <= oldAlpha) FailLow = true; else FailLow = false; } - return alpha; + return bestValue; }