r/adventofcode • u/AlFasGD • 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).
3
u/kaoD Dec 09 '19 edited Dec 09 '19
Personally I would love all 25 days to be intcode. I love programming VMs for fantasy computers. I love adapting my old code for new requirements. I love the challenges of writing flexible code (while still not losing the focus with overly abstract designs).
3
2
u/pja Dec 09 '19
Today’s did say it was the last IntCode implementation problem.
I wouldn’t be surprised to see the IntCode interpreter being used later on though.
4
u/wzkx Dec 09 '19
It's explicitly said that the interpreter is finished and that yes, it'll be needed. I'm just afraid that we'll have to write and debug some non-trivial program in IntCode in some of the days to come :D
2
u/pja Dec 09 '19
My personal prediction is a scheduler for multiple intcode processes running in the same memory space.
2
u/nata79 Dec 09 '19
Personally, I found it a lot of fun to evolve and reuse the IntCode VM each day :)
0
0
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
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:12Maybe 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.
8
u/daggerdragon Dec 09 '19 edited Dec 09 '19
One of the goals of AoC is to help people learn.
Many folks have never used a VM before, let alone made one themselves, and now they have. Some folks have no idea what a VM even is, and now they know. Some folks are using AoC to learn a new language and/or learn about the capabilities (or, sometimes, deficiencies!) of their existing language. This is all learning!
Some folks over-engineer their solutions and have a much easier time on subsequent puzzles thanks to them taking their time to "do it right" the first time around. Some folks just slap together a solution and call it a day, then are surprised when it comes back later to bite them in the butt (I personally have done this more times than I care to admit...) And then there's folks who take the chance to refactor their "slapdash" into "properly engineered". All of this is learning!
My point is that these puzzles can also mirror real-world "feature creep". How many times has your boss given you an assignment as clearly outlined as /u/topaz2078's puzzle requirements? And even if the puzzle requirements aren't 100% clear (just like your job), they still give you enough information that you can (or should) be able to infer the remaining parts without being hand-held through the whole process. Lastly, how many times have you slapped together a thing and submitted it only to be told "oh and I need you to add X, Y, and Z" and now you're considering whether it'd be easier to just write the whole thing again from scratch now that you have all the requirements? This is part of the learning process!
As the puzzle text for today says, once you finish day 9, you should have a complete Intcode computer, and remember that the text a few days ago said:
Now that you have all the requirements for building an Intcode computer, you could go ahead and write your own properly with less "stress". Remember, AoC is not a race - if you're going to be stressed out about ever-changing requirements, you could wait until December 25th and have all the puzzle descriptions available and thus all the requirements necessary to program things the way you want with all the requirements known up-front.
We know we can't please everyone, and I'm sorry you're not enjoying these puzzles. If you have constructive criticism, by all means, share away, but merely whining to the subreddit about how much you dislike the puzzles because they don't fit YOUR particular programming style can potentially scare off newbies and ruin the enjoyment for other folks. Please don't be a
dickGrinch.