- for (Color c = WHITE; c <= BLACK; ++c)
- for (PieceType pt : { PAWN, KNIGHT, KING })
- for (Square s = SQ_A1; s <= SQ_H8; ++s)
- for (int i = 0; steps[pt][i]; ++i)
- {
- Square to = s + Direction(c == WHITE ? steps[pt][i] : -steps[pt][i]);
-
- if (is_ok(to) && distance(s, to) < 3)
- {
- if (pt == PAWN)
- PawnAttacks[c][s] |= to;
- else
- PseudoAttacks[pt][s] |= to;
- }
- }
+ for (Square s1 = SQ_A1; s1 <= SQ_H8; ++s1)
+ {
+ PawnAttacks[WHITE][s1] = pawn_attacks_bb<WHITE>(square_bb(s1));
+ PawnAttacks[BLACK][s1] = pawn_attacks_bb<BLACK>(square_bb(s1));