[2019 Day 13 (Part 2)] Can't seem to run the actual game

Help - SOLVED!

I might be misunderstanding what I'm supposed to do. I did part one fairly easily, getting the amount of cubes but now I'm slightly confused, because I can't seem to get the game to run, it always behaves like if I did part 1.

If I understood the description correctly, you can run the game if you put 2 into your memory address 0. But, even with that, my intcode program always halts after the initial setup of the game, never asking for any input from the joystick or what not.

So this leads me to think that I should rerun the game every time I get to a 99 code (= halt), with the instruction pointer pointing at the address after the halt code (meaning I don't "reset" the game, but just continue at the next address) and I basically ignore all the halt codes that come up and only stop when the number of blocks hits 0?

Posted Dec 15, 2019, 12:08 PM UTC

16
Strigone•

Do you reset the memory, instruction and base pointer before putting 2 into memory address 0 and restarting the game?

1
FruloopsOP•

Hmm this might be something in the right direction. Right now I start running the game with memory address 0 set to 2, without running it normally before that.

Should I run the game first with memory address 0 set to the default value and when it halts, insert value 2 into the 0 memory address and then continue with the game execution and without resetting the memory and both pointers ?

1
Strigone•

No, you should run it normally with memory address 0 set to 2, it should ask for input

1
FruloopsOP•

And after hitting the halt state, should I reset memory and all pointers or should I continue running the program where I currently was, at the next address after the halt address?

1
mmddmm•

You should reset everything the program might have altered in part 1. This includes memory and the instruction pointer.

1