summaryrefslogtreecommitdiff
path: root/src/location.rs
diff options
context:
space:
mode:
authorTom Barrett <tombarrett@siu.edu>2017-11-24 03:42:02 -0600
committerTom Barrett <tombarrett@siu.edu>2017-11-24 03:42:02 -0600
commitae4e10f00eab3c9a7a9f5239392e67ef3c39fb1a (patch)
treee6ca958fe534adc91f898c3212a0f115122af9fa /src/location.rs
parenta853a837b8cb991d8c55496401bef02275139c4e (diff)
-made all character variables private
-moved path calculation to list level -moved needs_path to a function
Diffstat (limited to 'src/location.rs')
-rw-r--r--src/location.rs1
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),