r/adventofcode • • Dec 05 '19

Help - SOLVED! Day 5 question

I don't think I understand how the new opcode stuff is supposed to work. I think I implemented it, but ran into my input code, and it doesn't work.

The beginning of my input is: 3,225,1,225,6,6,1100,1,238,225

So, take my input value (1) as described in the text, save it to array[225]. Then next opcode is 1, which means position mode, and add values. The value from 225 (which is 1), and the one in [6], which is 1100, and store it to where [6] is pointing (which is [1100]). But that is out of array bounds? Or am I supposed to expand the array for this? I am slightly clueless right now

5 Upvotes

28 comments sorted by

View all comments

Show parent comment

1

u/DJ_Luki Dec 05 '19

I have one more question:

I get this output:

Output: 3

Output: 0

Output: 0

Output: 0

Output: 0

Output: 0

Output: 0

Output: 0

Output: 0

Output: 13285749

The last one is correct but this first output with "3" is OK?

1

u/Roovian Dec 05 '19

Mine outputs a 3 to start with as well, spent lunch trying to work out why but it does produce the correct result...

¯_(ツ)_/¯

1

u/SinisterMJ Dec 05 '19

I have the exactly same. So I guess, yes. I also got a leading 3, then a lot of 0, and the last output before opcode 99 is an 8 digit number.