Advent of Code - 2019 - Day 17 -18

The seventeenth problem problem was (there is an every second day pattern…) another Intcode problem. The task was to explore a maze (or a bunch of scaffolding), in part 1 we should compute a sum of all coordinates that was an intersection - entirely straightforward.

Part 2 was about providing a program to a small robot that should visit all of the maze, the caveat was that there was only a limited amount of space for the program (including sub-routines). Because of the construction of the maze it was, however, easy to write a navigation function that visited all of the maze, and then break the resulting trace up into suitable sub-routines. I ended up only solving this for my input, not the general case. No problems with run-time today.

122> aefa_sophia_test:run_file("/Users/hans/Personal/Repos/AoC2019/17/sol_17.aes", "setup", []).
0 steps / 265526634 gas / 0 reductions / 5207.16ms
  #{1 =>
        {tuple,{#{{tuple,{16,22}} => {tuple,{}},
                  {tuple,{14,13}} => {tuple,{}},
123> aefa_sophia_test:run_file("/Users/hans/Personal/Repos/AoC2019/17/sol_17.aes", "solve_1", []).
0 steps / 71673 gas / 0 reductions / 24.34ms
124> aefa_sophia_test:run_file("/Users/hans/Personal/Repos/AoC2019/17/sol_17.aes", "solve_2", []).
0 steps / 1199125790 gas / 0 reductions / 11443.52ms

My solution is here

1 Like

The eighteenth problem problem was a shortest path finding problem in a maze with locked doors. This makes a really tricky problem, since the possible paths keeps changing once you make your way through the maze. I managed to solve the problem, using Erlang, but that solution has to be improved by an order of magnitude (or two!) to be feasible to run in Sophia :frowning:

So temporarily I admit defeat, but I haven’t given up entirely yet… I think it can be done.

1 Like

I’m not taking credit for all the cleverness that goes into this solution - the majority of it is the work of @ulfnorell - but nevertheless it could be done in Sophia!

1 Like