Better conditional assignment
This commit is contained in:
parent
98555936d2
commit
3a1181d973
|
@ -188,12 +188,11 @@ impl aoc::Solver for Day {
|
||||||
.flat_map(Sensor::from_str)
|
.flat_map(Sensor::from_str)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let y_level;
|
let y_level = if input.lines().count() > 14 {
|
||||||
if input.lines().count() > 14 {
|
2000000
|
||||||
y_level = 2000000;
|
|
||||||
} else {
|
} else {
|
||||||
y_level = 10;
|
10
|
||||||
}
|
};
|
||||||
|
|
||||||
get_ranges(&sensors, y_level, true)
|
get_ranges(&sensors, y_level, true)
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -207,12 +206,12 @@ impl aoc::Solver for Day {
|
||||||
.lines()
|
.lines()
|
||||||
.flat_map(Sensor::from_str)
|
.flat_map(Sensor::from_str)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let max;
|
|
||||||
if input.lines().count() > 14 {
|
let max = if input.lines().count() > 14 {
|
||||||
max = 4000000;
|
4000000
|
||||||
} else {
|
} else {
|
||||||
max = 20;
|
20
|
||||||
}
|
};
|
||||||
|
|
||||||
for y_level in 0..(max+1) {
|
for y_level in 0..(max+1) {
|
||||||
let ranges = get_ranges(&sensors, y_level, false);
|
let ranges = get_ranges(&sensors, y_level, false);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user