Can request & respond to rematch

This commit is contained in:
2022-10-15 17:46:14 +02:00
parent a2c880814c
commit f2ec85b46f
3 changed files with 168 additions and 12 deletions

View File

@ -300,6 +300,12 @@ impl CurrentGameStatus {
BotType::Smart => self.find_smart_bot_fire_location(),
}
}
/// Check out whether game is over or not
pub fn is_game_over(&self) -> bool {
self.opponent_map.sunk_boats.len() == self.rules.boats_list().len()
|| self.your_map.sunk_boats.len() == self.rules.boats_list().len()
}
}
#[cfg(test)]