Validates the location of the asteroid strikes relative to the map.
(&self, mars_map: &PlanetMap)
| 508 | |
| 509 | /// Validates the location of the asteroid strikes relative to the map. |
| 510 | pub fn validate_asteroid_locations(&self, mars_map: &PlanetMap) -> bool { |
| 511 | // The asteroid must be on the mars map. |
| 512 | let mut valid = true; |
| 513 | for (round, asteroid) in &self.pattern { |
| 514 | if !mars_map.on_map(asteroid.location) { |
| 515 | println!("Asteroid on round {} lands off the map", round); |
| 516 | valid = false; |
| 517 | } |
| 518 | } |
| 519 | valid |
| 520 | } |
| 521 | |
| 522 | /// Whether there is an asteroid strike at the given round. |
| 523 | pub fn has_asteroid(&self, round: Rounds) -> bool { |