xfix

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

First 10 of 14 Posts Switch mode

xfix

xfix OP

Hardcoded part 2 solution, oh well. It’s much easier to solve this manually than to write code that does it.

cblavier

cblavier

Can’t figure out why my part1 output is wrong :exploding_head:

Can you tell me what is your part1 result for my puzzle input? puzzle17.txt · GitHub

I suspect a bug in my intcode VM … :frowning_face:

xfix

xfix OP

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.

cblavier

cblavier

:sob:

(thanks, it was indeed the issue !!!)

jenarvaezg

jenarvaezg

My solution for day 17.

When I did part 1, I expected to have to move the robot from start to finish for part 2, but the question was not what I expected. I calculated the movements by hand and pushed the data manually.

mexicat

mexicat

Thank you so much, I couldn’t figure out why the tests were working but the puzzle input was not!

bjorng

bjorng

Erlang Core Team

Here is my solution.

For part 2 I wrote a path finder function. (It would probably been faster to read out the path manually from printout in part 1, but what’s the fun in that?) My first attempt produced a too long path that I could not fit in the robot’s limited program space. I had to adjust the path finder to always going straight if possible so to avoid unnecessary turns. That shortened the path so I that could fit in the robot’s program memory.

If I hadn’t already been spending so much time on this puzzle, it would have been function to try to automatically split the path into the different parts of the robot’s program memory. I decided to split the path manually.

bjorng

bjorng

Erlang Core Team

I couldn’t resist the temptation to add an automatic splitter of the robot program.

Here is the updated code and here is the splitting code.

sb8244

sb8244

Author of Real-Time Phoenix

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 :frowning:

mortalisk

mortalisk

My solution

I also created an automated solution after first doing it manually. Manually was definitely faster :stuck_out_tongue:

Where Next?

Trending in Challenges Top

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement