- // Pawn captures
- b1 = pos.pawn_attacks(them, checksq) & pos.pawns(us) & not_pinned;
- while (b1)
- {
- from = pop_1st_bit(&b1);
- if (relative_rank(us, checksq) == RANK_8)
- {
- mlist[n++].move = make_promotion_move(from, checksq, QUEEN);
- mlist[n++].move = make_promotion_move(from, checksq, ROOK);
- mlist[n++].move = make_promotion_move(from, checksq, BISHOP);
- mlist[n++].move = make_promotion_move(from, checksq, KNIGHT);
- } else
- mlist[n++].move = make_move(from, checksq);
- }
-
- // Pieces captures
- b1 = ( (pos.piece_attacks<KNIGHT>(checksq) & pos.knights(us))
- | (pos.piece_attacks<BISHOP>(checksq) & pos.bishops_and_queens(us))
- | (pos.piece_attacks<ROOK>(checksq) & pos.rooks_and_queens(us)) ) & not_pinned;
-
- while (b1)
- {
- from = pop_1st_bit(&b1);
- mlist[n++].move = make_move(from, checksq);
- }
-
- // Blocking check evasions are possible only if the checking piece is
- // a slider
- if (checkers & pos.sliders())
- {
- Bitboard blockSquares = squares_between(checksq, ksq);
-
- assert((pos.occupied_squares() & blockSquares) == EmptyBoardBB);
-
- // Pawn moves. Because a blocking evasion can never be a capture, we
- // only generate pawn pushes.
- if (us == WHITE)
- n += generate_pawn_blocking_evasions<WHITE>(pos, not_pinned, blockSquares, mlist+n);
- else
- n += generate_pawn_blocking_evasions<BLACK>(pos, not_pinned, blockSquares, mlist+n);
-
- // Pieces moves
- b1 = pos.knights(us) & not_pinned;
- if (b1)
- n += generate_piece_blocking_evasions<KNIGHT>(pos, b1, blockSquares, mlist+n);
-
- b1 = pos.bishops(us) & not_pinned;
- if (b1)
- n += generate_piece_blocking_evasions<BISHOP>(pos, b1, blockSquares, mlist+n);
-
- b1 = pos.rooks(us) & not_pinned;
- if (b1)
- n += generate_piece_blocking_evasions<ROOK>(pos, b1, blockSquares, mlist+n);
-
- b1 = pos.queens(us) & not_pinned;
- if (b1)
- n += generate_piece_blocking_evasions<QUEEN>(pos, b1, blockSquares, mlist+n);
- }
-
- // Finally, the ugly special case of en passant captures. An en passant
- // capture can only be a check evasion if the check is not a discovered
- // check. If pos.ep_square() is set, the last move made must have been
- // a double pawn push. If, furthermore, the checking piece is a pawn,
- // an en passant check evasion may be possible.
- if (pos.ep_square() != SQ_NONE && (checkers & pos.pawns(them)))