diff options
Diffstat (limited to 'src/location.rs')
-rw-r--r-- | src/location.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/location.rs b/src/location.rs index ca40700..a6ac623 100644 --- a/src/location.rs +++ b/src/location.rs @@ -5,6 +5,7 @@ impl Location { pub fn distance(&self, other: &Location) -> usize { (((self.0 - other.0).pow(2) + (self.1 - other.1).pow(2)) as f64).sqrt() as usize } + pub fn neighbours(self, impassable : Vec<(Location, usize)>) -> Vec<(Location, usize)> { let mut nearby = vec![Location(self.0 + 1, self.1), Location(self.0 - 1, self.1), Location(self.0, self.1 + 1), Location(self.0, self.1 - 1), |