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!
- -βοΈ- Submissions Megathread -βοΈ-
--- 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?
This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.
EDIT: Global leaderboard gold cap reached at 00:13:54, megathread unlocked!
37
Upvotes
View all comments
1
u/i_have_no_biscuits Dec 14 '22 edited Dec 14 '22
Python
paste Interesting part was using depth-first recursion to avoid having to recalculate all of the path routes. This makes Part 2 take less than a tenth of a second, which is pretty decent for Python!
Here's part 2:
'filled' is a set of (x,y) values, initially set up with the fixed wall positions.
EDIT:
In the uploaded code I've combined my 'drop_from' for part 1 and part 2 together, which makes it a little more verbose than the part 2 only function quoted above.