From cbf47482ad825d58d53c1055469e24ee61ce708c Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 27 Feb 2025 23:32:20 -0500 Subject: [PATCH] simplify board functions --- src/repr/board.rs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/repr/board.rs b/src/repr/board.rs index a6c5fbe..d0a7ae6 100644 --- a/src/repr/board.rs +++ b/src/repr/board.rs @@ -123,9 +123,7 @@ impl Board { /// Provides an iterator of all possible positions on the board pub fn all_positions() -> impl Iterator { - (0..Self::BOARD_SIZE).flat_map(|i| { - (0..Self::BOARD_SIZE).map(move |j| (i as CoordAxis, j as CoordAxis).into()) - }) + (0..Self::BOARD_SIZE).flat_map(|i| (0..Self::BOARD_SIZE).map(move |j| (i, j).into())) } /// Returns an iterator of all possible moves a `color` can make @@ -133,20 +131,6 @@ impl Board { Self::all_positions().filter(move |&coord| self.would_prop(coord, color)) } - pub fn sides() -> impl Iterator { - (0..Self::BOARD_SIZE) - .map(|i| (i, Self::BOARD_SIZE - 1)) - .chain((0..Self::BOARD_SIZE).map(|i| (i, 0))) - .chain((0..Self::BOARD_SIZE).map(|j| (Self::BOARD_SIZE - 1, j))) - .chain((0..Self::BOARD_SIZE).map(|j| (0, j))) - } - - pub fn corners() -> impl Iterator { - [0, Self::BOARD_SIZE - 1] - .into_iter() - .flat_map(|i| [0, Self::BOARD_SIZE - 1].into_iter().map(move |j| (i, j))) - } - /// Get a reference to a backing [`BitBoard`] const fn board(&self, color: Piece) -> &BitBoard { match color {