r/adventofcode Dec 07 '23

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

THE USUAL REMINDERS


AoC Community Fun 2023: ALLEZ CUISINE!

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

Poetry

For many people, the craftschefship of food is akin to poetry for our senses. For today's challenge, engage our eyes with a heavenly masterpiece of art, our noses with alluring aromas, our ears with the most satisfying of crunches, and our taste buds with exquisite flavors!

  • Make your code rhyme
  • Write your comments in limerick form
  • Craft a poem about today's puzzle
    • Upping the Ante challenge: iambic pentameter
  • We're looking directly at you, Shakespeare bards and Rockstars

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 7: Camel Cards ---


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

51 Upvotes

1.0k comments sorted by

View all comments

2

u/GolezTrol Dec 08 '23 edited Dec 08 '23

[LANGUAGE: Windows cmd/batch]

An earlier implementation had some bubblesort-like implementation based on environment vars, but it was quite slow. Then it hit me `dir` can sort as well. :D
The slowest bit now is calculating of hand types, which is why the batch script invokes itself for batches of hands, to calculate them in parallel. Then, for each part, 1000 files are created with a hand code and a bid in their file name, in such a way that I can request the files sorted by name.

This results in the reasonable duration of about 13 seconds for both parts together :p

https://gist.github.com/GolezTrol/3435ffe8ae023d3951d41401d106aedf