MCPcopy Index your code
hub / github.com/battlecode/battlecode-2018 / validate_asteroid_locations

Method validate_asteroid_locations

battlecode-engine/src/map/mod.rs:510–520  ·  view source on GitHub ↗

Validates the location of the asteroid strikes relative to the map.

(&self, mars_map: &PlanetMap)

Source from the content-addressed store, hash-verified

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 {

Callers 1

validateMethod · 0.80

Calls 1

on_mapMethod · 0.80

Tested by

no test coverage detected