[rs] Solve 2022_10 part 2
This commit is contained in:
parent
745a205492
commit
1b2128d709
3 changed files with 26 additions and 2 deletions
|
|
@ -1,2 +1,8 @@
|
|||
Part 1: 12880
|
||||
Part 2: ???
|
||||
Part 2:
|
||||
####..##....##..##..###....##.###..####.
|
||||
#....#..#....#.#..#.#..#....#.#..#.#....
|
||||
###..#.......#.#..#.#..#....#.#..#.###..
|
||||
#....#.......#.####.###.....#.###..#....
|
||||
#....#..#.#..#.#..#.#....#..#.#.#..#....
|
||||
#.....##...##..#..#.#.....##..#..#.####.
|
||||
|
|
|
|||
|
|
@ -44,4 +44,16 @@ pub fn solve(input: String) {
|
|||
.map(|i| run.history[i - 1].x * i as i32)
|
||||
.sum::<i32>();
|
||||
println!("Part 1: {part1}");
|
||||
|
||||
println!("Part 2:");
|
||||
for chunk in run.history.chunks(40) {
|
||||
for (x, state) in chunk.iter().enumerate() {
|
||||
if (x as i32).abs_diff(state.x) <= 1 {
|
||||
print!("#");
|
||||
} else {
|
||||
print!(".");
|
||||
}
|
||||
}
|
||||
println!();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,8 @@
|
|||
Part 1: 13140
|
||||
Part 2: ???
|
||||
Part 2:
|
||||
##..##..##..##..##..##..##..##..##..##..
|
||||
###...###...###...###...###...###...###.
|
||||
####....####....####....####....####....
|
||||
#####.....#####.....#####.....#####.....
|
||||
######......######......######......####
|
||||
#######.......#######.......#######.....
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue