pub struct Game { /* private fields */ }
Expand description
Deterministic GridWorld with a single unit and goal tile.
Implementations§
Source§impl Game
impl Game
Sourcepub fn new(world_vector: Vec<Vec<char>>) -> Result<Self, GameError>
pub fn new(world_vector: Vec<Vec<char>>) -> Result<Self, GameError>
Construct a Game
from a 2D character grid.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset unit position and turn counter to the initial world configuration.
Sourcepub fn check_game_done(&self) -> bool
pub fn check_game_done(&self) -> bool
Whether the unit is currently on the goal tile.
Sourcepub fn world_configuration(&self) -> Vec<Vec<char>>
pub fn world_configuration(&self) -> Vec<Vec<char>>
Return a clone of the original world configuration.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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