feat: solve day 7

We parse the grid and then step through a simulation of the tachyon
beam's spread and count the number of splitters that the beam actually
hit.
This commit is contained in:
Jacob Jonsson 2025-12-07 20:22:46 +01:00
parent 7b7dd2660b
commit d8824fd6bd
3 changed files with 315 additions and 0 deletions

142
input/day7.txt Normal file
View file

@ -0,0 +1,142 @@
......................................................................S......................................................................
.............................................................................................................................................
......................................................................^......................................................................
.............................................................................................................................................
.....................................................................^.^.....................................................................
.............................................................................................................................................
....................................................................^.^.^....................................................................
.............................................................................................................................................
...................................................................^.....^...................................................................
.............................................................................................................................................
..................................................................^.^.^.^.^..................................................................
.............................................................................................................................................
.................................................................^.^...^...^.................................................................
.............................................................................................................................................
................................................................^.^.^.^.^.^.^................................................................
.............................................................................................................................................
...............................................................^.^.^.^...^...^...............................................................
.............................................................................................................................................
..............................................................^.^.....^.^...^.^..............................................................
.............................................................................................................................................
.............................................................^...^.....^.^.^.^.^.............................................................
.............................................................................................................................................
............................................................^...^.^.^.^...^.^.^.^............................................................
.............................................................................................................................................
...........................................................^.^.^.^...^...^.^...^.^...........................................................
.............................................................................................................................................
..........................................................^.^.^...^.^.^...^.^.^...^..........................................................
.............................................................................................................................................
.........................................................^.^...^.^.^.^.^.^.^.^.^.^.^.........................................................
.............................................................................................................................................
........................................................^.^...^.^.^.^.^.......^...^.^........................................................
.............................................................................................................................................
.......................................................^...^.^...^.^.......^.^...^.^.^.......................................................
.............................................................................................................................................
......................................................^...^.^...^.^...^.^...^.^.^.....^......................................................
.............................................................................................................................................
.....................................................^.^.^.^.^.^...........^.^...^.^...^.....................................................
.............................................................................................................................................
....................................................^.^.^...^.^.^.^.^.^.^...^.^.....^.^.^....................................................
.............................................................................................................................................
...................................................^.^.^.^...^.....^.........^...^...^.^.^...................................................
.............................................................................................................................................
..................................................^.^.^...^...^.^.^...^.^.^.^...^.^.....^.^..................................................
.............................................................................................................................................
.................................................^.^...^.^.^...^...^...^...^.^.^.^.^...^.^.^.................................................
.............................................................................................................................................
................................................^.^.^...........^.^.^.^.^.^.....^.^.^.....^.^................................................
.............................................................................................................................................
...............................................^.^.^.^.^.^.^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.^.^...............................................
.............................................................................................................................................
..............................................^...^.^.^.^...^...^.^.^.....^...^.^.^...^.^.^.^.^..............................................
.............................................................................................................................................
.............................................^.^.^.^.....^.^.^.^.^...^.^.^.^.^...^.^...^...^.^.^.............................................
.............................................................................................................................................
............................................^.^.^.^.^.^.....^.^.^...^.^.....^.^.^.....^.^...^...^............................................
.............................................................................................................................................
...........................................^.^.^...^.^.^.^...^.^.^.^.^.......^.^.^.^.^.^...^...^.^...........................................
.............................................................................................................................................
..........................................^.^.^.^...^.^.^.^.^.^.^.^...^.....^...^.^.^...^.^...^.^.^..........................................
.............................................................................................................................................
.........................................^.....^.^.^.^...^.^.^.....^.^.^.^.^.....^.^.^.^.^.^.^.^.^.^.........................................
.............................................................................................................................................
........................................^.^.^...^.....^...^.....^.^.^...^.^.^.^...^.^.^.^...^.^.^.^.^........................................
.............................................................................................................................................
.......................................^.^.^.........^...^...^...^.^.^.^...^.^.^.^...^.^.^.^.^...^...^.......................................
.............................................................................................................................................
......................................^.^...^.^.^...^.^.^.^.^.^...^...^.^.^...^.^.^.^...^.....^.......^......................................
.............................................................................................................................................
.....................................^...^.^.^.^.^.^.^.^.^.^.^.^.^...^...........^.^.^.^...^.....^.^.^.^.....................................
.............................................................................................................................................
....................................^.^.^.......^.^...^...^...^.....^.......^.^...^.......^.^.^.^...^.^.^....................................
.............................................................................................................................................
...................................^.^.^.^.^.^.....^.^...^.^.^.^.^...^.^.^...^.^.^.^.^...^...^.^.^.^.^.^.^...................................
.............................................................................................................................................
..................................^.^...^.^.^.^...^.....^...^.......^.^.^.^.^.^.^...^.^...^.^.....^.^.^.^.^..................................
.............................................................................................................................................
.................................^.^.^.^.^.^.^...^.^.....^.^.^.........^.^...^.^...^.....^.^.^.^.^.^...^.^.^.................................
.............................................................................................................................................
................................^...^.^.....^...^.^.^.^...^.^...^.^.^...^...^.^.^.^.^.^.^.....^.^.^...^.....^................................
.............................................................................................................................................
...............................^.....^...^...^.^.^...^.^.......^.^.^...^.^.^...^.^.^.^...^.^.^.^.^.^.....^...^...............................
.............................................................................................................................................
..............................^.^.^...^...^.....^.^.^.^.^.^...^.^...^...^...^.^.^.^.^.^.^...^.^.^.^...^.^.....^..............................
.............................................................................................................................................
.............................^.^.^.^...^.^...^.^...^...^.^...^.^.^.^...^.....^...^.^.^.......^.^.^...^...^.....^.............................
.............................................................................................................................................
............................^.....^...^...^.^.^.^.^.....^.^.^.^.^.......^.^.^.........^...........^.^.^...^.....^............................
.............................................................................................................................................
...........................^.^.^...^...^.^.....^.^.^.^.^.^.^.^.....^.^.^.^.^.^.^...^.....^.^...^.^.....^.^.^.^...^...........................
.............................................................................................................................................
..........................^.^.^.^.^...^.^.........^.^.^.^.....^...^.^.....^.^.^.^.^.^...^.....^...^.^.^.^...^.....^..........................
.............................................................................................................................................
.........................^...^.^...^.^.^.^...^...^...^...^.^...^.^.^.^.^.^.^...^.^.^.^...^.^.^.^.^.^...^.....^...^.^.........................
.............................................................................................................................................
........................^.^.^...^.^.^.......^...^.^.^.^.^.^...^.^.^...^...^.^.^...^.^.^...^.^.^.^...^...^.^.^.^.^.^.^........................
.............................................................................................................................................
.......................^...^...^.^.^.....^.^.....^.....^.^.^...^.^.......^.^.^.....^...^.^.....^.^.^.^.....^.^.^...^.^.......................
.............................................................................................................................................
......................^.......^.^.^...^.^...^.^...^.^.^.^.....^.^.^.^.^...^.^.^.^.^.^.....^.^.^.^.^.^.^.^.^.....^.^...^......................
.............................................................................................................................................
.....................^.^.^.^.^.^.^.^.^...^.^.^.^.....^.^.^.^.^.^.^.^.^.^.^.^.^...^.^.^...^.^.^...^.^.^.^.^.^.^...^.^.^.^.....................
.............................................................................................................................................
....................^.^...^.....^.^.^.^...^.^.^...^.^.^.^...^.^...^.^.^.....^.....^.^.^...^.^.^...^...^...^.^...^.^...^.^....................
.............................................................................................................................................
...................^.^.^.^.^.^.^...^.^...^.^.^.^...^.^.^.^.....^...^.^.^.^...^.^.^.^.^.^.......^.^...^.^.^.^.....^.^...^.^...................
.............................................................................................................................................
..................^.^.^...^.^...^...^.^.^.........^...^.^.^.^.^.^.^.^.^.^.....^.^...^...^.^.^.......^...^.....^...^.^.^...^..................
.............................................................................................................................................
.................^.^.^.^...^.^.^...^...^...^...^.^.^.^.......^.^.^.^.....^...^.^.^.^...^.^...^.^...^.....^.^.^.^.^.^.......^.................
.............................................................................................................................................
................^.^.....^...^.^.^...^.......^.^.^.^...^.^...^.^.^.^.^.^.^.......^...^...^...^...^.^...^...^...^...^.^.^.^.^.^................
.............................................................................................................................................
...............^.^.....^.....^.^.^.^.^.^...^.^...^.^.^.^.....^.^.^.^.^...^...^.^.^.......^.^.^.^.^...^.^...^...^.^.^.^.^.^...^...............
.............................................................................................................................................
..............^.^...^...^...^.^.^...^...^...^...^.^...^.^.^.^.^...^.^.^.^.^.^.^.^...^.^.......^.....^.........^.^.^.^.^.^.^.^.^..............
.............................................................................................................................................
.............^.^.^.^.^...^.^.^.^.^.^.^.^.^...^.^.^.^.^.^.^.^.^.^...^.^.^.^.^.^...^.^.^.^.......^...^.^...^.^.^.^.^.....^.^.^...^.............
.............................................................................................................................................
............^.....^.^.^.^.^.^.^.^.^.....^.^...^...^...^.^.^.^.........^.^.^.....^...^.^...^.^.^.....^.^.^.^.^...^.....^.^.^...^.^............
.............................................................................................................................................
...........^.....^.^...^.^...^.^.^.^...^...^...^.^.^.^.^.^.^.^.^.^.^.^.^.^.^...^.^.^.^.^.^.^.^.......^.^.^.^.^...^.^.^.^.....^.^.^...........
.............................................................................................................................................
..........^...^.^...^.^.^.^.^.^.^...^.^...^.^.^...^...^.^.^.....^.^.^.......^.^.^.^...^.^.^...^.^.^.^.^.^...^.^.....^...^...^.^...^..........
.............................................................................................................................................
.........^.^.^.^...^.^.^.....^.^...^.^.......^.^.....^.^.^.^.^.....^.^...^...^.^.^.......^.^.^.^.^...^.......^.^...^.^...^.^.^...^.^.........
.............................................................................................................................................
........^.^.....^.....^.^...^.^.....^.^...^.....^.^...^.^...^.^...^...^...^.^...^.^.^...^...^.^.....^.^.^.^.^.^.^...^.^.^.^...^.^.^.^........
.............................................................................................................................................
.......^.^.^...^.^.^.^.^...^...^...^.^.^.^.^.....^.^.^.^.^.^.^.^...^.^.^.^.^.^...^.^...^.^.......^.^.^.....^.^.^.^.^...^.....^.^...^.^.......
.............................................................................................................................................
......^.^.....^.^...^.^.^.^.^.....^...^...^.....^.^...^.^.......^.^.^.......^.....^.^.^.^.^.^.^.^.^.^...^.^.^.^.^.^...^...^.^...^.^.^.^......
.............................................................................................................................................
.....^.^.^.^.^...^...^.^.^...^.^.....^.^...^.......^.^.^...^.^...^.^.^.^.....^...^.^.^...^.^.^.^.....^.^.^.....^...^.^.^.^.^.^.^.^.^...^.....
.............................................................................................................................................
....^.^.^.^.^.^.^.^.^.........^.^...^.^.^.^.^.^.^.^.^...^.^.^...^.^.^.^.^.^...^.^.^.^.^.^...^.^.^...^.^.^...^...^.^...^.^.^.^.^.^...^.^.^....
.............................................................................................................................................
...^...^.....^...^.^.^.^.^...^.....^...^.^...^.^.^.^.^.^...^.^...^.^.^...^.^.^.^.^...^.^.^.^...^.^.^.^.^.^.^.........^.^...^.^.^.^.^.^.^.^...
.............................................................................................................................................
..^.....^.^.......^.^.^.^.^.^.^.^...^.^.^...^.^.^.^.^.^.^.^...^.^.^...^.^.^.^.....^.^.^...^.....^.^.^...^.^.^.^.........^.^.....^.....^.^.^..
.............................................................................................................................................
.^.^.^...^.^...^.^.^...^...^...^.....^.^...^.^...^.^.^...^...^.^...^...^.....^.....^.^.^...^.^.^.....^...^...^.^.^.^.^.^.....^.^.^.......^.^.
.............................................................................................................................................