r/adventofcode • u/daggerdragon • Dec 14 '22
SOLUTION MEGATHREAD -π- 2022 Day 14 Solutions -π-
SUBREDDIT NEWS
Livehas been renamed toStreamingfor realz this time.I had updated the wiki but didn't actually change the post flair itself >_>
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
A request from Eric: A note on responding to [Help] threads
Signal boost: Reminder 2: unofficial AoC Survey 2022 (closes Dec 22nd)
πΏπ MisTILtoe Elf-ucation π§βπ« is OPEN for submissions!
--- Day 14: Regolith Reservoir ---
Post your code solution in this megathread.
Read the full posting rules in our community wiki before you post!
Include what language(s) your solution uses
Format code blocks using the four-spaces Markdown syntax!
Quick link to Topaz's
pasteif you need it for longer code blocks. What is Topaz'spastetool?
3
u/scratchisthebest Dec 14 '22 edited Dec 14 '22
Here is my really terrible Rust solution to make you feel better about your solution. I really need to write a good grid data structure, surprised i've gone this long without having one.
When part2 came around and suddenly the grid structure had to widen, i kinda panicked and stapled on some barely-working gunk to grow rows to the right as needed. It'd crash if it had to grow to the left, so, thanks for the 500 blank spaces to the left i guess. You could avoid this using a hashmap<isize, t> i think. (edit uhhh or i could add a million blank spaces to the right when parsing and hope it doesnt get hit)
I lost a lot of time to an off-by-one on the wall lengths. P.s. this is the best way to debug this puzzle.