began score
This commit is contained in:
parent
17b7f7f62e
commit
ddfb320a11
1 changed files with 6 additions and 0 deletions
|
@ -57,6 +57,7 @@ impl Error for GameError {}
|
|||
#[derive(Clone)]
|
||||
pub struct Game {
|
||||
board: Grid,
|
||||
score: usize,
|
||||
spawn_per_turn: usize,
|
||||
}
|
||||
|
||||
|
@ -69,6 +70,7 @@ impl Game {
|
|||
|
||||
Self {
|
||||
board: Grid::new(size),
|
||||
score: 0,
|
||||
spawn_per_turn,
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +79,10 @@ impl Game {
|
|||
&self.board
|
||||
}
|
||||
|
||||
pub fn get_score(&self) -> usize {
|
||||
self.score
|
||||
}
|
||||
|
||||
pub fn turn(&mut self, movement: Move) -> Result<(), GameError> {
|
||||
self.perform_move(movement);
|
||||
for _ in 0..self.spawn_per_turn {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue