mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Update to new itertools version
This commit is contained in:
@@ -8,7 +8,7 @@ description = "Implementation of the problems of Advent of Code 2018"
|
|||||||
clap = "2.32"
|
clap = "2.32"
|
||||||
regex = "1.1.0"
|
regex = "1.1.0"
|
||||||
chrono = "0.4.6"
|
chrono = "0.4.6"
|
||||||
itertools = "0.7.11"
|
itertools = "0.8"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bencher = "0.1.5"
|
bencher = "0.1.5"
|
||||||
|
|||||||
@@ -68,14 +68,14 @@ impl Day10 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn height(&self) -> i32 {
|
fn height(&self) -> i32 {
|
||||||
match self.points.iter().skip(1).step(2).minmax() {
|
match self.points.iter().skip(1).step_by(2).minmax() {
|
||||||
MinMaxResult::MinMax(x, y) => { y - x + 1 }
|
MinMaxResult::MinMax(x, y) => { y - x + 1 }
|
||||||
_ => panic!("Input does not make sense."),
|
_ => panic!("Input does not make sense."),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn underestimate_time(&self) -> i32 {
|
fn underestimate_time(&self) -> i32 {
|
||||||
let (lower, upper) = match self.points.iter().enumerate().skip(1).step(2).minmax_by_key(|&(_, y)| y) {
|
let (lower, upper) = match self.points.iter().enumerate().skip(1).step_by(2).minmax_by_key(|&(_, y)| y) {
|
||||||
MinMaxResult::MinMax((x, _), (y, _)) => (x, y),
|
MinMaxResult::MinMax((x, _), (y, _)) => (x, y),
|
||||||
_ => panic!("Input does not make sense"),
|
_ => panic!("Input does not make sense"),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user