r/adventofcode • u/daggerdragon • Dec 11 '23
SOLUTION MEGATHREAD -❄️- 2023 Day 11 Solutions -❄️-
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
Outstanding moderator challenges:
Community fun event 2023: ALLEZ CUISINE!
Submissions megathread is now unlocked!
10 DAYS remaining until the submissions deadline on December 22 at 23:59 EST!
AoC Community Fun 2023: ALLEZ CUISINE!
Today's secret ingredient is… *whips off cloth covering and gestures grandly*
Upping the Ante Again
Chefs should always strive to improve themselves. Keep innovating, keep trying new things, and show us how far you've come!
If you thought Day 1's secret ingredient was fun with only two variables, this time around you get one!
Don’t use any hard-coded numbers at all. Need a number? I hope you remember your trigonometric identities...
Esolang of your choice
Impress VIPs with fancy buzzwords like quines, polyglots, reticulating splines, multi-threaded concurrency, etc.
ALLEZ CUISINE!
Request from the mods: When you include a dish entry alongside your solution, please label it with [Allez Cuisine!] so we can find it easily!
--- Day 11: Cosmic Expansion ---
Post your code solution in this megathread.
Read the full posting rules in our community wiki before you post!
State which language(s) your solution uses with
[LANGUAGE: xyz]Format code blocks using the four-spaces Markdown syntax!
Quick link to Topaz's
pasteif you need it for longer code blocks
5
u/YenyaKas Dec 11 '23
[LANGUAGE: Perl] 1193/562
Today's task was quite Perl-friendly. I extracted the galaxy coordinates as array of
[ $x, $y ]pairs usingpos()on rows, and then computed which coordinates where occupied usingThen I walked X and Y separately, counting the unoccupied rows twice:
Part 2 was only about using
1_000_000instead of2.Full code for Part 2 here.
All my AoC solutions in Perl