From: Jörg Oster Date: Sun, 25 Nov 2018 10:27:40 +0000 (+0100) Subject: Qsearch simplification. (#1828) X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=6ab92d2e1c417fa7a9fd87eee0add2bf02112296 Qsearch simplification. (#1828) Don't do an extra TT update in case of a fail-high, but simply break off the moves loop and let the TT update at the end of qsearch do this job. Same workflow/logic as in our main search function now. Tested for no regression to be on the safe side. STC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 30237 W: 6665 L: 6560 D: 17012 http://tests.stockfishchess.org/tests/view/5bf928e80ebc5902bced3f3a LTC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 51067 W: 8625 L: 8553 D: 33889 http://tests.stockfishchess.org/tests/view/5bf937180ebc5902bced3fdc No functional change. --- 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);