diff --git a/src/search.cpp b/src/search.cpp index 70124c589..634492682 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1049,16 +1049,11 @@ moves_loop: // When in check, search starts here } // SEE based pruning for captures and checks + // Avoid pruning sacrifices of our last piece for stalemate int margin = std::max(157 * depth + captHist / 29, 0); - if (!pos.see_ge(move, -margin)) - { - bool mayStalemateTrap = - depth > 2 && alpha < 0 && pos.non_pawn_material(us) == PieceValue[movedPiece]; - - // avoid pruning sacrifices of our last piece for stalemate - if (!mayStalemateTrap) - continue; - } + if ((alpha >= VALUE_DRAW || pos.non_pawn_material(us) != PieceValue[movedPiece]) + && !pos.see_ge(move, -margin)) + continue; } else {