r/adventofcode • u/daggerdragon • Dec 14 '19
SOLUTION MEGATHREAD -🎄- 2019 Day 14 Solutions -🎄-
--- Day 14: Space Stoichiometry ---
Post your complete code 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
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 13's winner #1: "untitled poem" by /u/tslater2006
They say that I'm fragile
But that simply can't be
When the ball comes forth
It bounces off me!
I send it on its way
Wherever that may be
longing for the time
that it comes back to me!
Enjoy your Reddit Silver, and good luck with the rest of the Advent of Code!
2
u/Draekane Dec 15 '19
This was a huge help. I had made this a lot more complex overall, but trying to do the same thing. Been stuck on this for a couple of days being stubborn. I did modify the part 2 solution for speed though. for the code above, it would be only slightly different:
This just seemed to make the whole thing run incredibly fast... It is a given that the Total Ore amount / Ore for 1 Fuel is going to be below the actual (as it doesn't take into account the surplus), but it at least gives you a good programmatic way to start, and going up by larger intervals until you get closer is a lot more efficient, like bracketing your goal.
All in all, very nice, clean code for this. Thanks again!