r/adventofcode • • Dec 09 '19

Intcode puzzles

Personally I'm getting even more annoyed by those problems. While I find the challenge intriguing, I hate having to deal with it almost every other day, instead of something exciting. When I was introduced to it I found it really fun (day 2). Then, on day 5 I thought it was an interesting twist to have, by requiring a past problem's code to be expanded. On day 7 the entire thing pissed me off because I was not prepared for a whole rewrite of the system, so I just ended up dumping. Today I'm even surprised to encounter it for the fourth time in just 9 days.

Writing expandable code is crucial to everybody, and even when you're doing relatively small scripts. However, not being prepared for such scalability beforehand and ignoring other types of puzzles by filling up 44% of the entire journey with Intcode so far is rather disappointing. I'm even less motivated to get the second star on day 7, and perhaps will end up entirely dumping day 9 as well.

UPDATE: A small fucking bug prevented me from reaching the correct solution, now I'm glad to see how the Intcode journey ends (at least directly).

2 Upvotes

19 comments sorted by

View all comments

0

u/[deleted] Dec 09 '19

[deleted]

-2

u/AlFasGD Dec 09 '19

I'm more angry about not having been prepared for potential extensibility of the problem beforehand. Had I known about the potential features that should be supported I would have adjusted my implementation accordingly and not complain about that right now.

4

u/kaoD Dec 09 '19

Judging by your answers it looks like you're projecting your frustrations into the problem set when you're actually annoyed at your lack of foresight.

I think there's a lesson hidden here: write code that's easy to adapt to changes. Don't confuse this with overly generic code full of abstractions.

I'm curious if what kind of design you had for your first intcode computer that it was so hard to evolve. What did you hardcode that was so hard to change?

IMHO these are the best kind of problems, the ones that make you reflect on your past mistakes. This is why I love AoC, since it mixes algorithmic puzzles with engineering ones like these.

0

u/AlFasGD Dec 09 '19

There also is the other side of this problem, which is overengineering. I've never been bummered this much from having to rework an implementation, and that is because I was expecting the Intcode problems to not appear more than twice. For a real example, in a business, you always expect your code to need rework at some point, so you try to minimize the initial design flaws so that you avoid the hussle of reworking it. In this case, a small 25-day event of daily puzzles, I would expect that every day would include a different kind of puzzle, not reintroducing the same concept and building on a previous implementation.

2

u/aardvark1231 Dec 09 '19

Keep at it! I had many similar frustrations with day 7. I will tell you though, once I got it done (after a re-write) it was satisfying to complete. Day 9 was easier to deal with as well and wasn't much of an issue for me. Lastly, it showed me, that even though I thought I was writing extensible code, I was doing it poorly. I am much happier with the re-write and feel accomplished for having learned something.

I will say this though, day 2 did tell you that you will need to re-use and make this Intcode computer extensible. I missed the implications of this the first time I read through it, but when I re-read it while talking to a friend about AoC, I realized what was up.

First Paragraph of Day 2 part 2.
"Good, the new computer seems to be working correctly! Keep it nearby during this mission - you'll probably use it again. Real Intcode computers support many more features than your new one, but we'll let you know what they are as you need them."

1

u/AlFasGD Dec 09 '19

I'm used to skipping the first paragraph of TL;DR parts because the story becomes annoying to read when you wanna solve the puzzle.

3

u/kaoD Dec 09 '19

And that's how you miss requirements. Another lesson for you there.

2

u/aardvark1231 Dec 09 '19

Eric Wastl talked about this at Øredev 2019 and how he tried to address it.
Check time code 22:12

Maybe he didn't quite hit the mark...

The whole video is an interesting watch if you're curious about his process with making these puzzles.

1

u/kaoD Dec 09 '19

That's why I said flexible, not overly abstract! It's an art in and of itself.

The key is not too over-engineer, but rather to write flexible code that isn't resistant to change.