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

Method add

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

Returns the location one square from this one in the given direction.

(&self, direction: Direction)

Source from the content-addressed store, hash-verified

159
160 /// Returns the location one square from this one in the given direction.
161 pub fn add(&self, direction: Direction) -> MapLocation {
162 MapLocation {
163 planet: self.planet,
164 x: self.x + direction.dx(),
165 y: self.y + direction.dy(),
166 }
167 }
168
169 /// Returns the location one square from this one in the opposite direction.
170 pub fn subtract(&self, direction: Direction) -> MapLocation {

Callers 15

mainMethod · 0.95
test_directionFunction · 0.95
mainMethod · 0.95
ok_if_can_moveMethod · 0.45
move_robotMethod · 0.45
attackMethod · 0.45
ok_if_can_harvestMethod · 0.45
harvestMethod · 0.45
ok_if_can_blueprintMethod · 0.45
blueprintMethod · 0.45
ok_if_can_replicateMethod · 0.45
replicateMethod · 0.45

Calls 2

dxMethod · 0.80
dyMethod · 0.80

Tested by 8

test_directionFunction · 0.76
test_rocket_successFunction · 0.36
test_rocket_loadFunction · 0.36
test_rocket_unloadFunction · 0.36
test_worker_harvestFunction · 0.36
test_rocketsFunction · 0.36