Skip to content

Commit

Permalink
because class exists
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilhenry committed Dec 14, 2023
1 parent e5d79e8 commit 22ced0b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 22ced0b

Please sign in to comment.