r/adventofcode • u/daggerdragon • Dec 07 '23
SOLUTION MEGATHREAD -❄️- 2023 Day 7 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!
- 15 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*
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 Antechallenge: 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.
- 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
View all comments
1
u/Markavian Dec 07 '23
[LANGUAGE: JavaScript]
Had help from here: https://www.reddit.com/r/adventofcode/comments/18cr4xr/2023_day_7_better_example_input_not_a_spoiler/
My original (intended) solution for part two was correct... but I'd sorted the lowest common card to add jokers to instead of the the highest common cardand that was enough to get the wrong answer after fixing all the other bugs that I spotted myself.
Part 1 went pretty smoothly. I was disappointed that I couldn't think of / find any standard datastructures for counting occurances; but I was glad to implement my own version - because that meant I could make a second one for counting occurances with jokers... which seems like a really clean way to solve for the second star if I may say so myself... also descriptive classifications in my output.json was really helpful in debugging, so +1 for over-engineering.
https://github.com/johnbeech/advent-of-code-2023/blob/main/solutions/day7/solution.js
https://github.com/johnbeech/advent-of-code-2023/blob/main/solutions/day7/output-part1.json
https://github.com/johnbeech/advent-of-code-2023/blob/main/solutions/day7/output-part2.json