+
+ // With EvalInfo we are able to know how many captures are possible before
+ // generating them. So avoid generating them in case we know are zero.
+ Color us = pos.side_to_move();
+ Color them = opposite_color(us);
+ bool noAttacks = ei && (ei->attackedBy[us][0] & pos.pieces_of_color(them)) == 0;
+ bool noCaptures = noAttacks && (pos.ep_square() == SQ_NONE) && !pos.has_pawn_on_7th(us);