diff --git a/2021/src/bin/day13.rs b/2021/src/bin/day13.rs index e966d37..ad017e5 100644 --- a/2021/src/bin/day13.rs +++ b/2021/src/bin/day13.rs @@ -4,6 +4,7 @@ use aoc2021::common::*; use itertools::Itertools; const DAY: usize = 13; +// Turns out the grid is so sparse, a set would have been better. Welp. type Parsed = (Vec>, Vec); enum Fold { @@ -68,7 +69,8 @@ fn part2((grid, instructions): &Parsed) -> String { for instruction in instructions { instruction.fold(&mut paper); // :thanking: } - paper.into_iter().map(|ys| ys.into_iter().map(|b| if b { '#' } else { ' ' }).collect::()).join("\n") + const OUTPUT_CHARS: [char; 2] = [' ', '#']; + paper.into_iter().map(|ys| ys.into_iter().map(|b| OUTPUT_CHARS[b as usize]).collect::()).join("\n") } fn main() {