summaryrefslogtreecommitdiff
path: root/src/location.rs
diff options
context:
space:
mode:
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 a6ac623..509b551 100644
--- a/src/location.rs
+++ b/src/location.rs
@@ -2,6 +2,7 @@
pub struct Location(pub i32, pub i32);
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
}