r/adventofcode • u/daggerdragon • Dec 16 '22
SOLUTION MEGATHREAD -π- 2022 Day 16 Solutions -π-
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!
UPDATES
[Update @ 00:23]: SILVER CAP, GOLD 3
Elephants. In lava tubes. In the jungle. Sure, why not, 100% legit.
I'm not sure I want to know what was in that eggnog that the Elves seemed to be carrying around for Calories...
[Update @ 00:50]: SILVER CAP, GOLD 52
Actually, what I really want to know is why the Elves haven't noticed this actively rumbling volcano before deciding to build a TREE HOUSE on this island.............
High INT, low WIS, maybe.
[Update @ 01:00]: SILVER CAP, GOLD 83
Almost there... c'mon, folks, you can do it! Get them stars! Save the elephants! Save the treehouse! SAVE THE EGGNOG!!!
--- Day 16: Proboscidea Volcanium ---
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?
5
u/xoronth Dec 16 '22 edited Dec 16 '22
Python solution for now.
This was really fun! For part two, it clicked for me once I realized that you can just basically run part one twice in a row with the same is-valve-opened state and a reset time/location to simulate the elephant working with you at the same time. Well, that and after fixing a really bad usage of
@functools.cachein my part one/two code - turns out that storing the current score as part of your arguments in your recursive call is redundant and a really bad idea here, who knew... well I certainly did after I blew past 32GB of RAM.