Nim
I'm caught up!
This one was pretty straighforward. Iterate through the beam path, recursively creating new beams when you hit splitters. The only gotcha is that you need a way to detect infinite loops that can be created by splitters. I opted to record energized non-special tiles as -
or |
, depending on which way the beam was traveling, and then abort any path that retreads those tiles in the same way. I meant to also use +
for where the beams cross, but I forgot and it turned out not to be necessary.
Part 2 was pretty trivial once the code for part 1 was written.