[rs] Solve 2022_10 part 2
This commit is contained in:
parent
745a205492
commit
1b2128d709
3 changed files with 26 additions and 2 deletions
|
|
@ -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!();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue