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

Method opposite

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

Returns the direction opposite this one, or Center if it's Center.

(&self)

Source from the content-addressed store, hash-verified

97
98 /// Returns the direction opposite this one, or Center if it's Center.
99 pub fn opposite(&self) -> Direction {
100 if *self == Center {
101 return Center;
102 }
103 let new_dir = ((*self as u8) + 4) % 8;
104 Direction::num_to_direction(new_dir)
105 }
106
107 /// Returns the direction 45 degrees to the left (counter-clockwise) of
108 /// this one, or Center if it's Center.

Callers 1

test_directionFunction · 0.80

Calls

no outgoing calls

Tested by 1

test_directionFunction · 0.64