view 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
line wrap: on
line source

--- Day 16: The Floor Will Be Lava ---

A laser/mirror problem - "/" and "\" are mirrors that reflect 90°.
"-" and "|" are splitters - transparent in the same orientation,
but TWO beams go at 90° if hit against the flat edge.
"." is empty space.

The laser starts in the top-right.

For an example map:

.|...\....
|.-.\.....
.....|-...
........|.
..........
.........\
..../.\\..
.-.-/..|..
.|....-|.\
..//.|....

The laser goes:

>|<<<\....
|v-.\^....
.v...|->>>
.v...v^.|.
.v...v^...
.v...v^..\
.v../2\\..
<->-/vv|..
.|<<<2-|.\
.v//.|.v..

Every space that the laser goes through is "energised", which gives:

######....
.#...#....
.#...#####
.#...##...
.#...##...
.#...##...
.#..####..
########..
.#######..
.#...#.#..

The count of energised spaces is 46.