iterator fixes
This commit is contained in:
@@ -74,6 +74,14 @@ impl Board {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn possible_moves(&self, color: Piece) -> Box<dyn Iterator<Item = (usize, usize)> + '_> {
|
||||
Box::new(
|
||||
(0..BOARD_SIZE)
|
||||
.flat_map(|i| (0..BOARD_SIZE).map(move |j| (i, j)))
|
||||
.filter(move |(i, j)| self.what_if(*i, *j, color).is_some()),
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to a place on the [`Board`]
|
||||
/// at (i, j)
|
||||
pub const fn get_mut(&mut self, i: usize, j: usize) -> &mut Option<Piece> {
|
||||
|
||||
Reference in New Issue
Block a user