diff --git a/src/day17/mod.rs b/src/day17/mod.rs index 0509cbe..08cd667 100644 --- a/src/day17/mod.rs +++ b/src/day17/mod.rs @@ -16,6 +16,18 @@ struct Block { y: usize, } +impl Block { + fn distance(&self, other: &Block) -> i32 { + let dx = (other.x as i32 - self.x as i32).abs(); + let dy = (other.y as i32 - self.y as i32).abs(); + dx + dy + } + + fn compare(&self, other: &Block) -> bool { + self.x == other.x && self.y == other.y + } +} + fn setup() -> Vec> { let name = "day17"; println!("Executing module '{name}' entrypoint . . . ");