pub enum Tile {
ClosedEmpty(Flag),
OpenEmpty,
OpenNumber(NonZeroU8),
Mine(Flag),
}
Expand description
A Minesweeper tile.
Variants§
ClosedEmpty(Flag)
A tile which is empty but hasn’t been opened yet.
OpenEmpty
A tile which has been opened and doesn’t have neighboring mines.
OpenNumber(NonZeroU8)
A tile which has been opened and has neighboring mines.
Mine(Flag)
A tile which has a mine inside, and whether it’s marked or not.
Implementations§
Source§impl Tile
impl Tile
Sourcepub fn is_safe(self) -> bool
pub fn is_safe(self) -> bool
Returns true
if clicking this tile does not end the game, false
otherwise.
Sourcepub fn is_required_to_open(self) -> bool
pub fn is_required_to_open(self) -> bool
Returns true
if this tile has to be clicked in order for the game to successfully end, false
otherwise.
This is false
for open mines — returns true
only for ClosedEmpty
.
Sourcepub fn flag_state(self) -> Option<Flag>
pub fn flag_state(self) -> Option<Flag>
Returns the type of flag installed on this tile, or None
if this tile is open and thus cannot hold a flag.
Sourcepub fn is_flagged(self) -> bool
pub fn is_flagged(self) -> bool
Returns true
if the flag_state
is Some(Flag::Flagged)
, false
otherwise.
Sourcepub fn peek_local(self) -> Option<ClickOutcome>
pub fn peek_local(self) -> Option<ClickOutcome>
Returns a ClickOutcome
from the data known only to this specific tile, or None
if returning one requires access to the field.