began score

This commit is contained in:
JOLIMAITRE Matthieu 2022-04-04 18:31:42 +03:00
parent 17b7f7f62e
commit ddfb320a11

View file

@ -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 {