From 22ced0b3d79606a57f2ff606cced081cfc3a0d94 Mon Sep 17 00:00:00 2001 From: Nikhil <25770025+nikhilhenry@users.noreply.github.com> Date: Thu, 14 Dec 2023 23:46:27 +0530 Subject: [PATCH] because class exists --- src/position.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/position.rs b/src/position.rs index a4e4047..90799b2 100644 --- a/src/position.rs +++ b/src/position.rs @@ -16,13 +16,13 @@ pub fn euclidean_distance(from: &Position, to: &Position) -> usize { pub fn manhattan_distance(from: &Position, to: &Position) -> usize { let x_dist = (from.x - to.x).abs(); let y_dist = (from.y - to.y).abs(); - (x_dist + y_dist) as usize + ((x_dist + y_dist) * 10) as usize } pub fn diagonal_distance(from: &Position, to: &Position) -> usize { let x_dist = (from.x - to.x).abs(); let y_dist = (from.y - to.y).abs(); - cmp::max(x_dist, y_dist) as usize + (cmp::max(x_dist, y_dist) * 10) as usize } impl Position {