r/adventofcode • • Dec 08 '23

SOLUTION MEGATHREAD -❄️- 2023 Day 8 Solutions -❄️-

THE USUAL REMINDERS


AoC Community Fun 2023: ALLEZ CUISINE!

Today's theme ingredient is… *whips off cloth covering and gestures grandly*

International Ingredients

A little je ne sais quoi keeps the mystery alive. Try something new and delight us with it!

  • Code in a foreign language

    • Written or programming, up to you!
    • If you don’t know any, Swedish Chef or even pig latin will do
  • Test your language’s support for Unicode and/or emojis
  • Visualizations using Unicode and/or emojis are always lovely to see

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 8: Haunted Wasteland ---


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:10:16, megathread unlocked!

52 Upvotes

968 comments sorted by

View all comments

1

u/levital Dec 08 '23 edited Dec 08 '23

[Language: Haskell]

I liked this one, and occasionally felt clever here (like parsing L/R to fst/snd). Tried brute-forcing part 2 at first on the off-chance that it works (it doesn't, though it might have if I hadn't constructed the entire paths in memory, not sure whether ghc optimizes that out). Quickly realized while the brute-force was running in the background that it would be an LCM solution, but I thought at first that this would mean I need to find cycle-lengths for every possible end-node and a respective initial point where the cycle starts (there's no guarantee, after all, that they all go back to the start). Fortunately the input was nice and just finding start node -> unique target node was enough.

Does it count as Allez Cuisine, if english is a foreign language for me? ;)

Edit: Of course the latter line was in jest, but here's a proper [Allez Cuisine!]: A rather questionable German translation. This feels appropriately cursed to me, even though I didn't have an idea how to replace language keywords. Thankfully Haskell doesn't have that many.

1

u/daggerdragon Dec 08 '23

Does it count as Allez Cuisine, if english is a foreign language for me? ;)

Nah, mate, Up Some Ante here and try a little harder :P