mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-26 05:10:32 +01:00
Implement day 25.
Part 2 was bonkers.
This commit is contained in:
@@ -43,6 +43,21 @@ impl<T> Point for (T, T, T)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Point for [T; 4]
|
||||
where T: Default + Add<Output=T> + Sub<Output=T> + Copy + Ord
|
||||
{
|
||||
type CoordType = T;
|
||||
|
||||
fn manhattan(self, other: Self) -> T {
|
||||
let mut dist = T::default();
|
||||
|
||||
for (&a, b) in self.iter().zip(other.iter()) {
|
||||
dist = dist + a.max(*b) - a.min(*b);
|
||||
}
|
||||
dist
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Apply Erathostenes's sieve to the supplied array
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user