[position] Implement a SliderRayToSquare trait

This trait declares ray_to_square() which should return a BitBoard representing
a ray from a Square to another Square. The ray should include the target Square.

PlacedPiece implements this trait.
This commit is contained in:
Eryn Wells 2024-02-01 08:42:19 -08:00
parent cac13b4bc7
commit 722a90b860
3 changed files with 141 additions and 7 deletions

View file

@ -220,8 +220,8 @@ impl MoveLibrary {
ray
}
pub(super) fn ray(&self, sq: Square, dir: Direction) -> BitBoard {
self.rays[sq as usize][dir as usize]
pub(super) fn ray(&self, sq: Square, dir: Direction) -> &BitBoard {
&self.rays[sq as usize][dir as usize]
}
pub(super) fn pawn_pushes(&self, sq: Square, color: Color) -> BitBoard {