X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=45e91e591ad768e213d7b003dd7dad5f4ffc3137;hp=c3c2925fcf70f5dfff640875fd1295be5d924606;hb=62b43130e27e4322c5edde976d0827840b9deee4;hpb=bb968fd42a6e3c14755332f5a4c4829faaf4f9de diff --git a/src/search.cpp b/src/search.cpp index c3c2925f..45e91e59 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1542,6 +1542,36 @@ namespace { // Update current move movesSearched[moveCount++] = ss[ply].currentMove = move; + // Futility pruning for captures + // FIXME: test disabling 'Futility pruning for captures' + // FIXME: test with 'newDepth < RazorDepth' + Color them = opposite_color(pos.side_to_move()); + + if ( !isCheck + && newDepth < SelectiveDepth + && !dangerous + && pos.move_is_capture(move) + && !pos.move_is_check(move, ci) + && !move_is_promotion(move) + && move != ttMove + && !move_is_ep(move) + && (pos.type_of_piece_on(move_to(move)) != PAWN || !pos.pawn_is_passed(them, move_to(move)))) // Do not prune passed pawn captures + { + int preFutilityValueMargin = 0; + + if (newDepth >= OnePly) + preFutilityValueMargin = 112 * bitScanReverse32(int(newDepth) * int(newDepth) / 2); + + Value futilityCaptureValue = ss[ply].eval + pos.endgame_value_of_piece_on(move_to(move)) + preFutilityValueMargin + ei.futilityMargin + 90; + + if (futilityCaptureValue < beta) + { + if (futilityCaptureValue > bestValue) + bestValue = futilityCaptureValue; + continue; + } + } + // Futility pruning if ( !isCheck && !dangerous @@ -1960,7 +1990,10 @@ namespace { assert(value > -VALUE_INFINITE && value < VALUE_INFINITE); if (thread_should_stop(threadID)) + { + lock_grab(&(sp->lock)); break; + } // New best move? if (value > sp->bestValue) // Less then 2% of cases @@ -2094,7 +2127,10 @@ namespace { assert(value > -VALUE_INFINITE && value < VALUE_INFINITE); if (thread_should_stop(threadID)) + { + lock_grab(&(sp->lock)); break; + } // New best move? if (value > sp->bestValue) // Less then 2% of cases