mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 00:56:39 +08:00
Allow to prune bad captures
Only good capture are preserved from futility pruning and LMR reducing. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -1147,6 +1147,7 @@ namespace {
|
|||||||
Value value, bestValue = -VALUE_INFINITE;
|
Value value, bestValue = -VALUE_INFINITE;
|
||||||
Bitboard dcCandidates = mp.discovered_check_candidates();
|
Bitboard dcCandidates = mp.discovered_check_candidates();
|
||||||
Value futilityValue = VALUE_NONE;
|
Value futilityValue = VALUE_NONE;
|
||||||
|
MovePicker::MovegenPhase moveType;
|
||||||
bool isCheck = pos.is_check();
|
bool isCheck = pos.is_check();
|
||||||
bool useFutilityPruning = UseFutilityPruning
|
bool useFutilityPruning = UseFutilityPruning
|
||||||
&& depth < SelectiveDepth
|
&& depth < SelectiveDepth
|
||||||
@@ -1155,14 +1156,14 @@ namespace {
|
|||||||
// Loop through all legal moves until no moves remain or a beta cutoff
|
// Loop through all legal moves until no moves remain or a beta cutoff
|
||||||
// occurs.
|
// occurs.
|
||||||
while ( bestValue < beta
|
while ( bestValue < beta
|
||||||
&& (move = mp.get_next_move()) != MOVE_NONE
|
&& (move = mp.get_next_move(&moveType)) != MOVE_NONE
|
||||||
&& !thread_should_stop(threadID))
|
&& !thread_should_stop(threadID))
|
||||||
{
|
{
|
||||||
assert(move_is_ok(move));
|
assert(move_is_ok(move));
|
||||||
|
|
||||||
bool singleReply = (isCheck && mp.number_of_moves() == 1);
|
bool singleReply = (isCheck && mp.number_of_moves() == 1);
|
||||||
bool moveIsCheck = pos.move_is_check(move, dcCandidates);
|
bool moveIsCheck = pos.move_is_check(move, dcCandidates);
|
||||||
bool moveIsCapture = pos.move_is_capture(move);
|
bool moveIsGoodCapture = (moveType == MovePicker::PH_GOOD_CAPTURES);
|
||||||
bool moveIsPassedPawnPush = pos.move_is_passed_pawn_push(move);
|
bool moveIsPassedPawnPush = pos.move_is_passed_pawn_push(move);
|
||||||
|
|
||||||
movesSearched[moveCount++] = ss[ply].currentMove = move;
|
movesSearched[moveCount++] = ss[ply].currentMove = move;
|
||||||
@@ -1174,7 +1175,7 @@ namespace {
|
|||||||
// Futility pruning
|
// Futility pruning
|
||||||
if ( useFutilityPruning
|
if ( useFutilityPruning
|
||||||
&& ext == Depth(0)
|
&& ext == Depth(0)
|
||||||
&& !moveIsCapture
|
&& !moveIsGoodCapture
|
||||||
&& !moveIsPassedPawnPush
|
&& !moveIsPassedPawnPush
|
||||||
&& !move_promotion(move))
|
&& !move_promotion(move))
|
||||||
{
|
{
|
||||||
@@ -1206,7 +1207,7 @@ namespace {
|
|||||||
if ( depth >= 2*OnePly
|
if ( depth >= 2*OnePly
|
||||||
&& ext == Depth(0)
|
&& ext == Depth(0)
|
||||||
&& moveCount >= LMRNonPVMoves
|
&& moveCount >= LMRNonPVMoves
|
||||||
&& !moveIsCapture
|
&& !moveIsGoodCapture
|
||||||
&& !move_promotion(move)
|
&& !move_promotion(move)
|
||||||
&& !moveIsPassedPawnPush
|
&& !moveIsPassedPawnPush
|
||||||
&& !move_is_castle(move)
|
&& !move_is_castle(move)
|
||||||
@@ -2020,7 +2021,6 @@ namespace {
|
|||||||
assert(threat == MOVE_NONE || move_is_ok(threat));
|
assert(threat == MOVE_NONE || move_is_ok(threat));
|
||||||
assert(!move_promotion(m));
|
assert(!move_promotion(m));
|
||||||
assert(!pos.move_is_check(m));
|
assert(!pos.move_is_check(m));
|
||||||
assert(!pos.move_is_capture(m));
|
|
||||||
assert(!pos.move_is_passed_pawn_push(m));
|
assert(!pos.move_is_passed_pawn_push(m));
|
||||||
assert(d >= OnePly);
|
assert(d >= OnePly);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user