Mercurial > repos > other > adventofcode2023
view day16.txt @ 25:79dc2ba41df2
Copy a Dijkstra's Algorithm implementation
Gets us the shorted route but doesn't handle the additional
"keep turning" conditions
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 17 Dec 2023 10:32:05 +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.