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 {