- int generate_pawn_checks(const PawnOffsets& ofs, const Position& pos, Bitboard dc, Square ksq, MoveStack* mlist, int n)
- {
- // Pawn moves which give discovered check. This is possible only if the
- // pawn is not on the same file as the enemy king, because we don't
- // generate captures.
- Bitboard empty = pos.empty_squares();
-
- // Find all friendly pawns not on the enemy king's file
- Bitboard b1 = pos.pawns(pos.side_to_move()) & ~file_bb(ksq), b2, b3;
-
- // Discovered checks, single pawn pushes
- b2 = b3 = (ofs.forward)(b1 & dc) & ~ofs.Rank8BB & empty;
- while (b3)
- {
- Square to = pop_1st_bit(&b3);
- mlist[n++].move = make_move(to - ofs.DELTA_N, to);
- }
-
- // Discovered checks, double pawn pushes
- b3 = (ofs.forward)(b2 & ofs.Rank3BB) & empty;
- while (b3)
- {
- Square to = pop_1st_bit(&b3);
- mlist[n++].move = make_move(to - ofs.DELTA_N - ofs.DELTA_N, to);
- }
-
- // Direct checks. These are possible only for pawns on neighboring files
- // of the enemy king
-
- b1 &= (~dc & neighboring_files_bb(ksq)); // FIXME why ~dc ??
-
- // Direct checks, single pawn pushes
- b2 = (ofs.forward)(b1) & empty;
- b3 = b2 & pos.pawn_attacks(ofs.them, ksq);
- while (b3)
- {
- Square to = pop_1st_bit(&b3);
- mlist[n++].move = make_move(to - ofs.DELTA_N, to);
- }
-
- // Direct checks, double pawn pushes
- b3 = (ofs.forward)(b2 & ofs.Rank3BB) & empty & pos.pawn_attacks(ofs.them, ksq);
- while (b3)
- {
- Square to = pop_1st_bit(&b3);
- mlist[n++].move = make_move(to - ofs.DELTA_N - ofs.DELTA_N, to);
- }
- return n;
- }
-
-
- template<PieceType Piece>
- int generate_piece_blocking_evasions(const Position& pos, Bitboard b,
- Bitboard blockSquares, MoveStack* mlist, int n) {
- while (b)