X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=38d5683493a5b14df76a7196a340b49a8b429ebd;hp=f4e1da977990f18d2b77e988cbbc4c1c0798370e;hb=6ab92d2e1c417fa7a9fd87eee0add2bf02112296;hpb=bb58bc215c93a17cd6ee672eac5495b48e9f3d22 diff --git a/src/search.cpp b/src/search.cpp index f4e1da97..38d56834 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1395,21 +1395,15 @@ moves_loop: // When in check, search starts from here if (value > alpha) { + bestMove = move; + if (PvNode) // Update pv even in fail-high case update_pv(ss->pv, move, (ss+1)->pv); if (PvNode && value < beta) // Update alpha here! - { alpha = value; - bestMove = move; - } - else // Fail high - { - tte->save(posKey, value_to_tt(value, ss->ply), BOUND_LOWER, - ttDepth, move, ss->staticEval); - - return value; - } + else + break; // Fail high } } } @@ -1420,7 +1414,8 @@ moves_loop: // When in check, search starts from here return mated_in(ss->ply); // Plies to mate from the root tte->save(posKey, value_to_tt(bestValue, ss->ply), - PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER, + bestValue >= beta ? BOUND_LOWER : + PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER, ttDepth, bestMove, ss->staticEval); assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);