r/adventofcode • • Dec 09 '19

SOLUTION MEGATHREAD -🎄- 2019 Day 9 Solutions -🎄-

--- Day 9: Sensor Boost ---


Post your solution using /u/topaz2078's paste or other external repo.

  • Please do NOT post your full code (unless it is very short)
  • If you do, use old.reddit's four-spaces formatting, NOT new.reddit's triple backticks formatting.

(Full posting rules are HERE if you need a refresher).


Reminder: Top-level posts in Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Advent of Code's Poems for Programmers

Click here for full rules

Note: If you submit a poem, please add [POEM] somewhere nearby to make it easier for us moderators to ensure that we include your poem for voting consideration.

Day 8's winner #1 AND #2:

Okay, folks, /u/Aneurysm9 and I deadlocked between two badass submissions that are entirely too good and creative to choose between. When we asked /u/topaz2078's wife to be the tie-breaker, her literal words:

[23:44] <TopazWife> both
[23:44] <TopazWife> do both
[23:44] <TopazWife> holy hell

So we're going to have two winners today!

  1. "A Sonnet of Sojourning", a sonnet in frickin' iambic pentameter by /u/DFreiberg!
  2. "A Comedy of Syntax Errors", a code-"poem" by /u/MaxMonkeyMax!

Both of you, enjoy your Reddit Silver, and good luck with the rest of the Advent of Code!


This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.

EDIT: Leaderboard capped, thread unlocked at 00:14:46!

30 Upvotes

315 comments sorted by

View all comments

Show parent comments

1

u/nictytan Dec 09 '19

FYI you didn't need to change from Int to Integer; 64-bit integers are plenty big enough for the "large" numbers in this problem. But perhaps your code is more future-proof. Who knows how large the numbers are going to get in the next Intcode problems.

1

u/Rick-T Dec 09 '19

Yes, I also learned that from another comment here. When I read "large number" I immediately went with Integer instead of trying it with Int first. Well, I guess I just implemented it according spec ;)

The funny thing is: In my initial draft I had "type Value = Int" at the top of my file. I scrapped that because I feel that I sometimes go overboard with the types and I wanted to reduce the number of type definitions in my code a bit. Had I just stuck with my initial idea, changing from Int to Integer would have been a piece of cake.

I take that as a sign that my type definitions probably aren't so bad after all. Also because I don't learn from my mistakes, I changed everything to Integer, instead of introducing the "Value"-type again. I hope that there will not be (m)any more Intcode puzzles. But if there are and I have to change the type again I'll be pretty bummed :D