|
| 1 | +#pragma once |
| 2 | + |
| 3 | +#include <bitbishop/bitboard.hpp> |
| 4 | +#include <bitbishop/square.hpp> |
| 5 | + |
| 6 | +/** |
| 7 | + * @brief Computes rook attacks along the north direction. |
| 8 | + * |
| 9 | + * Returns all squares reachable by a rook moving north from the given square, |
| 10 | + * stopping at the first occupied square (inclusive). |
| 11 | + * |
| 12 | + * This function is occupancy-dependent and intended for runtime move generation. |
| 13 | + * |
| 14 | + * @param from The starting square |
| 15 | + * @param occupied Bitboard of all occupied squares on the board |
| 16 | + * @return Bitboard of attacked squares along the north direction |
| 17 | + */ |
| 18 | +Bitboard rook_north_attacks(Square from, const Bitboard& occupied); |
| 19 | + |
| 20 | +/** |
| 21 | + * @brief Computes rook attacks along the south direction. |
| 22 | + * |
| 23 | + * Returns all squares reachable by a rook moving south from the given square, |
| 24 | + * stopping at the first occupied square (inclusive). |
| 25 | + * |
| 26 | + * @param from The starting square |
| 27 | + * @param occupied Bitboard of all occupied squares on the board |
| 28 | + * @return Bitboard of attacked squares along the south direction |
| 29 | + */ |
| 30 | +Bitboard rook_south_attacks(Square from, const Bitboard& occupied); |
| 31 | + |
| 32 | +/** |
| 33 | + * @brief Computes rook attacks along the east direction. |
| 34 | + * |
| 35 | + * Returns all squares reachable by a rook moving east from the given square, |
| 36 | + * stopping at the first occupied square (inclusive). |
| 37 | + * |
| 38 | + * @param from The starting square |
| 39 | + * @param occupied Bitboard of all occupied squares on the board |
| 40 | + * @return Bitboard of attacked squares along the east direction |
| 41 | + */ |
| 42 | +Bitboard rook_east_attacks(Square from, const Bitboard& occupied); |
| 43 | + |
| 44 | +/** |
| 45 | + * @brief Computes rook attacks along the west direction. |
| 46 | + * |
| 47 | + * Returns all squares reachable by a rook moving west from the given square, |
| 48 | + * stopping at the first occupied square (inclusive). |
| 49 | + * |
| 50 | + * @param from The starting square |
| 51 | + * @param occupied Bitboard of all occupied squares on the board |
| 52 | + * @return Bitboard of attacked squares along the west direction |
| 53 | + */ |
| 54 | +Bitboard rook_west_attacks(Square from, const Bitboard& occupied); |
| 55 | + |
| 56 | +/** |
| 57 | + * @brief Computes all rook attacks from a square, given board occupancy. |
| 58 | + * |
| 59 | + * Combines the four orthogonal attack directions (north, south, east, west) |
| 60 | + * and returns the full set of squares attacked by a rook on the given square. |
| 61 | + * |
| 62 | + * This function is occupancy-dependent and performs no legality filtering: |
| 63 | + * it does not account for piece color, pins, check, or king safety. |
| 64 | + * |
| 65 | + * Intended as a low-level attack generator for: |
| 66 | + * - legal move generation |
| 67 | + * - check detection |
| 68 | + * - pin detection |
| 69 | + * - attack maps |
| 70 | + * |
| 71 | + * @param from The starting square |
| 72 | + * @param occupied Bitboard of all occupied squares on the board |
| 73 | + * @return Bitboard of all squares attacked by the rook |
| 74 | + */ |
| 75 | +Bitboard rook_attacks(Square from, const Bitboard& occupied); |
0 commit comments