xfix
Advent of Code 2019 - Day 17
Note: This topic is to talk about Day 17 of the Advent of Code 2019 .
There is a private leaderboard for elixirforum members. You can join it by following this link and entering the following code:
39276-eeb74f9a
Most Liked
xfix
Giving a hint, just in case you have the same bug as I had in my interpreter (and took a while to figure out). Specifically I constructed the output by doing [x | xs]. This however meant the output was reversed, but as it happens, this wasn’t really an issue until Day 17 part 1 (seriously, I only realized the issue now, as it happens, no previous tasks cared about whether the output was reversed or not).
If you have two newlines at the start of an output, that’s the issue. Those should be at end, not at the start.
sasajuric
Wow, this was very finicky!
I refused to solve the problem manually. It was clear to me in the morning that it’s not tricky in the algorithmical sense, but that there will be many fine-print details to pay attention to.
I ultimately solved it in a brute-force fashion. I did a depth-first search to find complete paths, then on each path I look for a valid program. This boils down to trying all possible triplets of main routines until I’m able to encode the entire thing into three routines, none of which exceeds the desired length.
The code is available here. It could use a bit more of a cleanup, can’t say it’s my finest hour 
sb8244
That’s impressive! Great work on doing the actual automated solution here.
I don’t think I did anything special—it’s a pretty standard solution. I was a bit frustrated because I knew the right path to do when only 25 people had solved both parts. But I had flipped my graph around (r, c iteration instead of c, r) and it completely changed my result. So I spent about 3 hours on it in the end. Once I realized the inversion mistake, I had the answer in about 10 minutes 







