Struct roguelike::Game
[−]
[src]
pub struct Game { pub position: (usize, usize), pub action: Action, // some fields omitted }
The Game with accompanying state
Fields
position: (usize, usize)
Position of the player, defined as (row, column) coordinate on the world map
action: Action
Last action that you took
Methods
impl Game
[src]
fn new(print: bool) -> Game
Initialize a new game state and optionally print it
fn get_moves(&self) -> u32
Getter for the count of moves made
fn get_score(&self) -> u32
Getter for the current score
fn has_won(&self) -> bool
Getter for whether or not the game has been won
fn distance_to_goal(&self) -> f64
Euclidean distance to the goal
fn enter_move(&mut self, dir: &Dir, print: bool) -> bool
Enter move and optionally print the map, returning whether or not this move won the game
fn print_map(&self)
Prints the map on screen
Trait Implementations
impl PartialEq for Game
[src]
fn eq(&self, __arg_0: &Game) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Game) -> bool
This method tests for !=
.
impl Eq for Game
[src]
impl Hash for Game
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Clone for Game
[src]
fn clone(&self) -> Game
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more