+ if (!pos.see_ge(move, occupied, Value(-206) * depth))
+ {
+ if (depth < 2 - capture)
+ continue;
+ // Don't prune the move if opp. King/Queen/Rook is attacked by a slider after the exchanges.
+ // Since in see_ge we don't update occupied when the king recaptures, we also don't prune the
+ // move when the opp. King gets a discovered slider attack DURING the exchanges.
+ Bitboard leftEnemies = pos.pieces(~us, ROOK, QUEEN, KING) & 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;
+ // Exclude Queen/Rook(s) which were already threatened before SEE
+ if (attacks && sq != pos.square<KING>(~us) && (pos.attackers_to(sq, pos.pieces()) & pos.pieces(us)))
+ attacks = 0;
+ }
+ if (!attacks)
+ continue;
+ }