mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Simplify part 2
This commit is contained in:
@@ -82,14 +82,7 @@ pub fn part2(input: &mut dyn Read) -> String {
|
|||||||
let target = grid.iter().map(|line| line.len()).sum();
|
let target = grid.iter().map(|line| line.len()).sum();
|
||||||
|
|
||||||
(1..)
|
(1..)
|
||||||
.find_map(|step| {
|
.find(|_| advance(&mut grid, &mut todo) == target)
|
||||||
let flashes = advance(&mut grid, &mut todo);
|
|
||||||
if flashes == target {
|
|
||||||
Some(step)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user