This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Part 2 - I don't know. Running as I write this, because I grew tired of waiting UPDATED: 58 minutes. Wow that's slow. I can't think of a way to optimize at this time
Another day, another Intcode.
At least part 1 looks fairly simple. Add another mode, add another opcode, and adjust my Intcode macro to work.
Adding another mode was pretty easy. For my lookup values, had to add another option for mode 2, relative mode. If things were in relative mode, need to add whatever the current relative mode base is to the number following the relative mode instruction. I added that to both of the lookups so that it could be used for any of the opcodes.
It was also easy to modify my output field to include instructions for opcode 9, which was to add the new number for relative base to the current relative base.
And that's where the easy stopped. First realization. READ THE INSTRUCTIONS CAREFULLY!!! They warned that the numbers would get large. So, had to adjust the padding added in Day 5 to be 19 characters long instead of 9. That meant adjusting a whole lot of formulas.
Still not working. Look at the instructions again, and think that the memory needing to be bigger might mean that the puzzle input doesn't have enough records. OK, easy enough to fix. Add a generate rows tool to generate a few hundred more rows, and append those onto the original data BEFORE running the Summarize tool to re-generate the string needed for my macro. Took a few trial and errors before I figured out the order here:
Still running as you can see (56,000 iterations so far. Part 1 only took 205)
Now my data set is in order, but things still aren't working. Time to use the macro debugger. I'm seeing that my Output field isn't working well with regenerating the big string field. My best guess is it's a data type issue, because I've adjusted all of my formulas to work with the bigger numbers. So, instead of using V_String as the data type, I'll try a Fixed Decimal without any decimals. My number can't be bigger than 19 characters, so I'll limit it to that.
Add a select tool after the formula tool in my macro to convert the Output back into V_String. Add a new formula tool to generate the string field again. No, this doesn't make much sense to me either, but hey, it works now!!
My latest Intcode:
I'll update this post when Part 2 finally finishes. Update: crawled through the finish line at 58 minutes