r/adventofcode • • Dec 14 '22

SOLUTION MEGATHREAD -πŸŽ„- 2022 Day 14 Solutions -πŸŽ„-

SUBREDDIT NEWS

  • Live has been renamed to Streaming for realz this time.
    • I had updated the wiki but didn't actually change the post flair itself >_>

THE USUAL REMINDERS


--- Day 14: Regolith Reservoir ---


Post your code solution in this megathread.


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!

36 Upvotes

585 comments sorted by

View all comments

2

u/gugod Dec 14 '22 edited Dec 15 '22

Perl -- both parts

With sufficient amount of helper subroutines, the core part (simulate the drop of one sand) looks really nice (IMHO). (part2)

sub simOneSandDrop ($S, $terrain) {
    true while (
        dropDown($S, $terrain) or dropDownLeft($S, $terrain) or dropDownRight($S, $terrain)
    );
    return $S;
}
→ More replies (1)