view day16.txt @ 24:19481b061461

Implement tilting and cycling for Day 14 part 2 Lots of false starts trying to iterate. Eventually looked for "back in same position" to spot a loop. Then took longer to spot that "same position" isn't necessarily "start position" and loop can be offset!
author IBBoard <dev@ibboard.co.uk>
date Sat, 16 Dec 2023 20:39:02 +0000
parents ad73a2ff3d06
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.