pub struct Board { /* private fields */ }Expand description
The game board, aka. the minefield.
Implementations§
Source§impl Board
impl Board
Sourcepub fn new(
width: NonZero<usize>,
height: NonZero<usize>,
mines: u8,
duds: u8,
) -> Result<Self, Error>
pub fn new( width: NonZero<usize>, height: NonZero<usize>, mines: u8, duds: u8, ) -> Result<Self, Error>
Sourcepub fn visit(&mut self, coordinate: Coordinate) -> MoveResult
pub fn visit(&mut self, coordinate: Coordinate) -> MoveResult
Visit the field at the given coordinate.
Sourcepub fn toggle_flag(&mut self, coordinate: Coordinate) -> MoveResult
pub fn toggle_flag(&mut self, coordinate: Coordinate) -> MoveResult
Toggle the flag on the field under the given coordinate.
Sourcepub fn visit_non_flagged_fields(&mut self) -> MoveResult
pub fn visit_non_flagged_fields(&mut self) -> MoveResult
Visit all fields on the grid, which have not been flagged.
This is a convenience function to quickly uncover all fields, which are deemed safe to conclude the game.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Board
impl !RefUnwindSafe for Board
impl !Send for Board
impl !Sync for Board
impl Unpin for Board
impl !UnwindSafe for Board
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more