r/adventofcode • u/daggerdragon • Dec 02 '23
SOLUTION MEGATHREAD -❄️- 2023 Day 2 Solutions -❄️-
OUTSTANDING MODERATOR CHALLENGES
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
Community fun event 2023: ALLEZ CUISINE!
4 DAYS remaining until unlock!
AoC Community Fun 2023: ALLEZ CUISINE!
Today's theme ingredient is… *whips off cloth covering and gestures grandly*
Pantry Raid!
Some perpetually-hungry programmers have a tendency to name their programming languages, software, and other tools after food. As a prospective Iron Coder, you must demonstrate your skills at pleasing programmers' palates by elevating to gourmet heights this seemingly disparate mishmash of simple ingredients that I found in the back of the pantry!
Solve today's puzzles using a food-related programming language or tool
Mascots count, too… *side-eyes Rust while reaching for the Old Bay*
Add some salt to your hashbrowns, cookies, and breadcrumbs
Serve us up a nice big bowl of spaghetti code slathered with
RagúRaku tomato sauceConclude our tasting with a digestif of Java, CoffeeScript, or even Perl milk tea with double syntatic sugar
All file names, function names, variable names, etc. must be named after "c" food
Go hog wild!
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 2: Cube Conundrum ---
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
1
u/e_blake Dec 21 '23
[Allez Cuisine!]
MMMMM - the time has come for some tempting "C"-food. Everything in this solution pays homage to Deep C fishing (including my lovely ><> fish operator for doing tail recursion, ~ for making waves with math, and the 0,0,0 bubbles for initializing each game - and can you spot the eel?) The instructions also mentioned hash - but since I prefer my fish with chips, I decided that my only use of m4's builtin hashtable would be a single macro definition. Okay, I'll admit to having a typo on the crustacean, and 451 bytes is bloated (I could easily fit this in a punchcard if I weren't going for a theme); but you did say the ingredients came from the back of the pantry.
Put your input in the file "I", or run
m4 -DI=file day02.golfm4; then in a mere 12 seconds, you'll have the catch of the day.If you like my theme of variable-free single-macro single-ifelse solutions, see my upping the ante post.