- for (Square s = SQ_A1; s <= SQ_H8; ++s)
- {
- PawnAttacks[WHITE][s] = pawn_attacks_bb<WHITE>(square_bb(s));
- PawnAttacks[BLACK][s] = pawn_attacks_bb<BLACK>(square_bb(s));
- }
-
- // Helper returning the target bitboard of a step from a square
- auto landing_square_bb = [&](Square s, int step)
- {
- Square to = Square(s + step);
- return is_ok(to) && distance(s, to) <= 2 ? square_bb(to) : Bitboard(0);
- };
-
- for (Square s = SQ_A1; s <= SQ_H8; ++s)
- {
- for (int step : {-9, -8, -7, -1, 1, 7, 8, 9} )
- PseudoAttacks[KING][s] |= landing_square_bb(s, step);
-
- for (int step : {-17, -15, -10, -6, 6, 10, 15, 17} )
- PseudoAttacks[KNIGHT][s] |= landing_square_bb(s, step);
- }
-