- int steps[][9] = { {}, { 7, 9 }, { 17, 15, 10, 6, -6, -10, -15, -17 },
- {}, {}, {}, { 9, 7, -7, -9, 8, 1, -1, -8 } };
-
- for (Color c = WHITE; c <= BLACK; c++)
- for (PieceType pt = PAWN; pt <= KING; pt++)
- for (Square s = SQ_A1; s <= SQ_H8; s++)
- for (int k = 0; steps[pt][k]; k++)
- {
- Square to = s + Square(c == WHITE ? steps[pt][k] : -steps[pt][k]);
-
- if (is_ok(to) && square_distance(s, to) < 3)
- StepAttacksBB[make_piece(c, pt)][s] |= to;
- }
-
- Square RDeltas[] = { DELTA_N, DELTA_E, DELTA_S, DELTA_W };
- Square BDeltas[] = { DELTA_NE, DELTA_SE, DELTA_SW, DELTA_NW };
-
- init_magics(RTable, RAttacks, RMagics, RMasks, RShifts, RDeltas, magic_index<ROOK>);
- init_magics(BTable, BAttacks, BMagics, BMasks, BShifts, BDeltas, magic_index<BISHOP>);
-
- for (Square s = SQ_A1; s <= SQ_H8; s++)
- {
- PseudoAttacks[QUEEN][s] = PseudoAttacks[BISHOP][s] = attacks_bb<BISHOP>(s, 0);
- PseudoAttacks[QUEEN][s] |= PseudoAttacks[ ROOK][s] = attacks_bb< ROOK>(s, 0);
+ for (PieceType pt : { BISHOP, ROOK })
+ for (Square s2 = SQ_A1; s2 <= SQ_H8; ++s2)
+ if (PseudoAttacks[pt][s1] & s2)
+ LineBB[s1][s2] = (attacks_bb(pt, s1, 0) & attacks_bb(pt, s2, 0)) | s1 | s2;