{
// We have already handled promotion moves, so destination
// cannot be on the 8th/1st rank.
- if (mandatory_pawn_promotion() && (promotion_zone_bb(us, promotion_rank(), max_rank()) & to))
+ if (mandatory_pawn_promotion() && rank_of(to) == relative_rank(us, promotion_rank(), max_rank()))
return false;
if ( !(attacks_from<PAWN>(us, from) & pieces(~us) & to) // Not a capture
// Our move must be a blocking evasion or a capture of the checking piece
Square checksq = lsb(checkers());
if ( !((between_bb(checksq, square<KING>(us)) | checkers()) & to)
- || (LeaperAttacks[~us][type_of(piece_on(checksq))][checksq] & square<KING>(us)))
+ || ((LeaperAttacks[~us][type_of(piece_on(checksq))][checksq] & square<KING>(us)) && !(checkers() & to)))
return false;
}
// In case of king moves under check we have to remove king so as to catch
for (const auto& m : MoveList<LEGAL>(pos))
{
+ assert(pos.pseudo_legal(m));
if (Root && depth <= ONE_PLY)
cnt = 1, nodes++;
else