r/adventofcode • u/daggerdragon • Dec 18 '22
SOLUTION MEGATHREAD -π- 2022 Day 18 Solutions -π-
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
πΏπ MisTILtoe Elf-ucation π§βπ« is OPEN for submissions!
5 days remaining until submission deadline on December 22 at 23:59 EST
UPDATES
[Update @ 00:02:55]: SILVER CAP, GOLD 0
Silver capped before I even finished deploying this megathread >_>
--- Day 18: Boiling Boulders ---
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:12:29, megathread unlocked!
32
Upvotes
4
u/Colin-McMillen Dec 18 '22 edited Dec 19 '22
C on the Apple //c
First part was much easier than expected, second part much harder. I went with DFS to figure out which empty "spots" can reach outside, then counted adjacent faces to outside empty spots.
Took me a while getting part 2 running on the //c, although valgrind showed zero errors, callgrind showed a very reasonable number of cycles, and massif a very reasonable amount of RAM used.
I had not thought that 3D DFS on the //c means "Deeply Fried Stack". Added a recursion depth condition to my lookup function, ran it sequentially from 0,0,0 to 19,19,19, thinking it would absolutely not work, but it does and I have no idea why!
Here it is :) and the viz.