X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=85817cd16f36c98183e57503a685215ded87feab;hp=f07085eda32f6f956cd0a64f3e48acda38cfa2d7;hb=35b77b120ef5ca5d9db848e02e42642b1a93e982;hpb=352bd6f5aa348e15909f50266fc5bdc003df35bf diff --git a/src/search.cpp b/src/search.cpp index f07085ed..85817cd1 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -97,8 +97,8 @@ namespace { Move best = MOVE_NONE; }; - // EasyMoveManager structure is used to detect an 'easy move'. When the PV is - // stable across multiple search iterations, we can quickly return the best move. + // EasyMoveManager structure is used to detect an 'easy move'. When the PV is stable + // across multiple search iterations, we can quickly return the best move. struct EasyMoveManager { void clear() { @@ -635,7 +635,7 @@ namespace { // Penalty for a quiet ttMove that fails low else if (!pos.capture_or_promotion(ttMove)) { - Value penalty = -stat_bonus(depth + ONE_PLY); + Value penalty = -stat_bonus(depth); thisThread->history.update(pos.side_to_move(), ttMove, penalty); update_cm_stats(ss, pos.moved_piece(ttMove), to_sq(ttMove), penalty); } @@ -868,12 +868,7 @@ moves_loop: // When in check search starts from here moveCountPruning = depth < 16 * ONE_PLY && moveCount >= FutilityMoveCounts[improving][depth / ONE_PLY]; - // Step 12. Extensions - // Extend checks - if ( givesCheck - && !moveCountPruning - && pos.see_ge(move, VALUE_ZERO)) - extension = ONE_PLY; + // Step 12. Singular and Gives Check Extensions // Singular extension search. If all moves but one fail low on a search of // (alpha-s, beta-s), and just one fails high on (alpha, beta), then that move @@ -882,7 +877,6 @@ moves_loop: // When in check search starts from here // ttValue minus a margin then we extend the ttMove. if ( singularExtensionNode && move == ttMove - && !extension && pos.legal(move)) { Value rBeta = std::max(ttValue - 2 * depth / ONE_PLY, -VALUE_MATE); @@ -894,6 +888,10 @@ moves_loop: // When in check search starts from here if (value < rBeta) extension = ONE_PLY; } + else if ( givesCheck + && !moveCountPruning + && pos.see_ge(move, VALUE_ZERO)) + extension = ONE_PLY; // Calculate new depth for this move newDepth = depth - ONE_PLY + extension; @@ -1127,10 +1125,11 @@ moves_loop: // When in check search starts from here && cm_ok) update_cm_stats(ss-1, pos.piece_on(prevSq), prevSq, stat_bonus(depth)); - tte->save(posKey, value_to_tt(bestValue, ss->ply), - bestValue >= beta ? BOUND_LOWER : - PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER, - depth, bestMove, ss->staticEval, TT.generation()); + if(!excludedMove) + tte->save(posKey, value_to_tt(bestValue, ss->ply), + bestValue >= beta ? BOUND_LOWER : + PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER, + depth, bestMove, ss->staticEval, TT.generation()); assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);