pub struct MineSweeper {
pub state: GameState,
pub width: i32,
pub height: i32,
pub mine_count: i32,
board: Vec<Cell>,
revealed: Vec<bool>,
}
Fields§
§state: GameState
§width: i32
§height: i32
§mine_count: i32
§board: Vec<Cell>
§revealed: Vec<bool>
Implementations§
Source§impl MineSweeper
impl MineSweeper
pub fn new(config: Config) -> Result<Self>
pub fn to_json(&self) -> String
pub fn to_json_pretty(&self) -> String
fn to_json_raw(&self) -> MsStateJson
pub fn reveal(&mut self, x: i32, y: i32) -> Result<GameState>
fn reveal_raw(&mut self, x: i32, y: i32) -> Option<Cell>
fn check_state(&self) -> GameState
fn convert(&self, x: i32, y: i32) -> Option<usize>
fn convert_raw(x: i32, y: i32, w: i32, h: i32) -> Option<usize>
Auto Trait Implementations§
impl Freeze for MineSweeper
impl RefUnwindSafe for MineSweeper
impl Send for MineSweeper
impl Sync for MineSweeper
impl Unpin for MineSweeper
impl UnwindSafe for MineSweeper
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more