&& (ss-1)->statScore < 17329
&& eval >= beta
&& eval >= ss->staticEval
- && ss->staticEval >= beta - 21 * depth - improvement * 99 / 1300 + 258
+ && ss->staticEval >= beta - 21 * depth - improvement / 13 + 258
&& !excludedMove
&& pos.non_pawn_material(us)
&& (ss->ply >= thisThread->nmpMinPly))
+ captureHistory[movedPiece][to_sq(move)][type_of(pos.piece_on(to_sq(move)))] / 7 < alpha)
continue;
+ Bitboard occupied;
// SEE based pruning (~11 Elo)
- if (!pos.see_ge(move, Value(-205) * depth))
- continue;
+ if (!pos.see_ge(move, occupied, Value(-205) * depth))
+ {
+ if (depth < 2 - capture)
+ continue;
+ // Don't prune the move if opponent Queen/Rook is under discovered attack after the exchanges
+ // Don't prune the move if opponent King is under discovered attack after or during the exchanges
+ Bitboard leftEnemies = (pos.pieces(~us, KING, QUEEN, ROOK)) & occupied;
+ Bitboard attacks = 0;
+ occupied |= to_sq(move);
+ while (leftEnemies && !attacks)
+ {
+ Square sq = pop_lsb(leftEnemies);
+ attacks |= pos.attackers_to(sq, occupied) & pos.pieces(us) & occupied;
+ // don't consider pieces which were already threatened/hanging before SEE exchanges
+ if (attacks && (sq != pos.square<KING>(~us) && (pos.attackers_to(sq, pos.pieces()) & pos.pieces(us))))
+ attacks = 0;
+ }
+ if (!attacks)
+ continue;
+ }
}
else
{