- if (is_ok(to) && distance(s, to) < 3)
- StepAttacksBB[make_piece(c, pt)][s] |= to;
- }
-
- Square RookDeltas[] = { DELTA_N, DELTA_E, DELTA_S, DELTA_W };
- Square BishopDeltas[] = { DELTA_NE, DELTA_SE, DELTA_SW, DELTA_NW };
-
- init_magics(RookTable, RookAttacks, RookMagics, RookMasks, RookShifts, RookDeltas, magic_index<ROOK>);
- init_magics(BishopTable, BishopAttacks, BishopMagics, BishopMasks, BishopShifts, BishopDeltas, magic_index<BISHOP>);
+ // 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);
+ };