visibleSquares

fun visibleSquares(piece: Piece, square: Square, position: Position): Long

Calculates a bitboard of all squares "visible" or attacked by a specific piece from a given square.

Note on Pawn Behavior: For Piece.WP and Piece.BP, this returns only the squares targeted for capture (the diagonals). It does not include forward movement squares, as those are not considered "attacks" or "visible" interactions with other pieces.

Return

A Long bitboard representing all squares attacked or reachable by the piece.

Since

v1.0.0-beta.7

Parameters

piece

The specific piece type (including color) being evaluated.

square

The origin square where the piece is currently located.

position

The current board state used to retrieve occupancy bitboards.

Throws

If an invalid or null piece type is provided.