pub struct Game { /* private fields */ }Expand description
The game object with the board and metadata.
Implementations§
Source§impl Game
impl Game
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 rows(&self) -> impl Iterator<Item = impl Iterator<Item = View>>
pub fn rows(&self) -> impl Iterator<Item = impl Iterator<Item = View>>
Return an iterator of field views over the game board’s rows.
Sourcepub fn columns(&self) -> impl Iterator<Item = impl Iterator<Item = View>>
pub fn columns(&self) -> impl Iterator<Item = impl Iterator<Item = View>>
Return an iterator of field views over the game board’s columns.
Sourcepub fn iter(&self) -> impl Iterator<Item = View>
pub fn iter(&self) -> impl Iterator<Item = View>
Return an iterator oif field views over the game board’s fields.
Sourcepub fn end(&self) -> Option<Instant>
pub fn end(&self) -> Option<Instant>
Returns the instance of then the game ended, if applicable.
Sourcepub fn is_won(&self) -> Option<bool>
pub fn is_won(&self) -> Option<bool>
Return the outcome of the game, if it has concluded.
§Returns
Some(true)if the game is won.Some(false)if the game is lost.Noneif the game is still running.
Sourcepub fn next_round(&mut self, action: Action) -> Option<State>
pub fn next_round(&mut self, action: Action) -> Option<State>
Play the next round.
Return Some(State) if the player did not request to abort the game, otherwise None.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Game
impl RefUnwindSafe for Game
impl Send for Game
impl Sync for Game
impl Unpin for Game
impl UnwindSafe for Game
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