comparison day16.txt @ 22:ad73a2ff3d06

Implement Day 15 part 1 and all of Day 16 Hash implementation was trivial, but I skipped the rest for now. Day 16 part 1 approach works unchanged for part 2! Just needed to run repeatedly with different inputs.
author IBBoard <dev@ibboard.co.uk>
date Sat, 16 Dec 2023 14:42:06 +0000
parents
children
comparison
equal deleted inserted replaced
21:46fb65f2cb94 22:ad73a2ff3d06
1 --- Day 16: The Floor Will Be Lava ---
2
3 A laser/mirror problem - "/" and "\" are mirrors that reflect 90°.
4 "-" and "|" are splitters - transparent in the same orientation,
5 but TWO beams go at 90° if hit against the flat edge.
6 "." is empty space.
7
8 The laser starts in the top-right.
9
10 For an example map:
11
12 .|...\....
13 |.-.\.....
14 .....|-...
15 ........|.
16 ..........
17 .........\
18 ..../.\\..
19 .-.-/..|..
20 .|....-|.\
21 ..//.|....
22
23 The laser goes:
24
25 >|<<<\....
26 |v-.\^....
27 .v...|->>>
28 .v...v^.|.
29 .v...v^...
30 .v...v^..\
31 .v../2\\..
32 <->-/vv|..
33 .|<<<2-|.\
34 .v//.|.v..
35
36 Every space that the laser goes through is "energised", which gives:
37
38 ######....
39 .#...#....
40 .#...#####
41 .#...##...
42 .#...##...
43 .#...##...
44 .#..####..
45 ########..
46 .#######..
47 .#...#.#..
48
49 The count of energised spaces is 46.