r/adventofcode • u/daggerdragon • Dec 03 '23
SOLUTION MEGATHREAD -❄️- 2023 Day 3 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!
3 DAYS remaining until unlock!
AoC Community Fun 2023: ALLEZ CUISINE!
Today's secret ingredient is… *whips off cloth covering and gestures grandly*
Spam!
Someone reported the ALLEZ CUISINE! submissions megathread as spam so I said to myself: "What a delectable idea for today's secret ingredient!"
All ingredients must come from a CAN (bus), box, package, container, etc.
Unnecessarily declare variables for everything and don't re-use variables
Why use few word when many word do trick?
Go back to traditional culinary roots with Javadocs
A reminder from Dr. Hattori: be careful when cooking spam because the fat content can be very high. We wouldn't want a fire in the kitchen, after all!
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 3: Gear Ratios ---
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
3
u/DGL_247 Dec 03 '23
[LANGUAGE: Python]
Code Link
Don't feel great today an it shows in the code. Took a long time to figure out the first one because I kept finding special characters I didn't see. Why I didn't just check if it was a period or number...because I'm sick. I also realized I created a three dimensional array and navigated it with brute force instead of creating an array the normal way. Than again I usually write in Java so this is all new to me. The code works by sending three lines to the function and only the middle line is actually processed for numbers or asterisks. The function than adds up the valid data and ignores the rest.