advent-of-code/2019/src/point.rs

9 lines
191 B
Rust
Raw Normal View History

2019-12-03 10:04:33 +00:00
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub struct Point(pub i32, pub i32);
impl Point {
pub fn manhattan_distance(&self) -> i32 {
2019-12-04 10:09:06 +00:00
self.0.abs() + self.1.abs()
2019-12-03 10:04:33 +00:00
}
2019-12-04 10:09:06 +00:00
}