MCPcopy Create free account
hub / github.com/battlecode/battlecode-2018 / is_within_range

Method is_within_range

battlecode-engine/src/location.rs:273–278  ·  view source on GitHub ↗

Whether this location is within the distance squared range of the specified location, inclusive. False for locations on different planets.

(&self, range: u32, o: MapLocation)

Source from the content-addressed store, hash-verified

271 /// Whether this location is within the distance squared range of the
272 /// specified location, inclusive. False for locations on different planets.
273 pub fn is_within_range(&self, range: u32, o: MapLocation) -> bool {
274 if self.planet != o.planet {
275 return false;
276 }
277 range >= self.distance_squared_to(o)
278 }
279}
280
281/// Any location in the Battlecode world.

Callers 2

Calls 3

distance_squared_toMethod · 0.80
is_on_mapMethod · 0.80
map_locationMethod · 0.80

Tested by

no test coverage detected