...
Honestly? Your guess is as good as mine. It's Day 21, and we're exploiting an integer underflow bug in the space-time continuum? In order to save Christmas? I guess?
I think I'm going to have to spend some time on this one before I even understand exactly what it is that we have to do. All I know is that we are fiddling with the registers in our time machine again so that we don't go back in time indefinitely forever.
Ho. Ho. Ho.
Good luck! đŸ¤¶
Top comments (4)
First I have translated the input into "assembler" using the disassembler I did for day 19, and then I reassembled the solution into C++.
In the code, the program exits when register 5 is equal to register 0.
So I've added the code to check those two conditions.
For part 1, I used the same interpreter as in the previous days. I had to convert all registers to numbers, then I just waited until the final condition could be checked.
For part 2, the interpreter was too slow, so I rewrote the whole program by hand. Running it then took 2.5 minutes.
JavaScript solution
My case was exactly the same as @jmgimeno , I used the same analyzer from day 19 and I came down to the same conclusions as him:
As usual, I'm gonna omit reader.js which is the same as the other solutions and jump to the point:
21a.js
21b.js
Don't know if I'm alone here but seeing all your posts starting with "AoC" over the past few days triggered a reaction in my brain that made me want to play AoE!!!