r/adventofcode • u/daggerdragon • Dec 03 '25
SOLUTION MEGATHREAD -❄️- 2025 Day 3 Solutions -❄️-
DO NOT SHARE PUZZLE TEXT OR YOUR INDIVIDUAL PUZZLE INPUTS!
I'm sure you're all tired of seeing me spam the same ol' "do not share your puzzle input" copypasta in the megathreads. Believe me, I'm tired of hunting through all of your repos too XD
If you're using an external repo, before you add your solution in this megathread, please please please 🙏 double-check your repo and ensure that you are complying with our rules:
- Do not share the puzzle text
- Do not share your puzzle input
- Do not commit puzzle inputs to your public repo
- e.g. use
.gitignoreor the like - Here's a decent post from 2023: (RE not sharing inputs) PSA: "deleting" and committing to git doesn't actually remove it
If you currently have puzzle text/inputs in your repo, please scrub all puzzle text and puzzle input files from your repo and your commit history! Don't forget to check prior years too!
NEWS
Solutions in the megathreads have been getting longer, so we're going to start enforcing our rules on oversized code.
Do not give us a reason to unleash AutoModerator hard-line enforcement that counts characters inside code blocks to verify compliance… you have been warned XD
THE USUAL REMINDERS
- All of our rules, FAQs, resources, etc. are in our community wiki.
AoC Community Fun 2025: Red(dit) One
- Submissions megathread is now unlocked!
- 14 DAYS remaining until the submissions deadline on December 17 at 18:00 EST!
Featured Subreddit: /r/thingsforants
"Just because you can’t see something doesn’t mean it doesn’t exist."
— Charlie Calvin, The Santa Clause (1994)
What is this, a community for advent ants?! Here's some ideas for your inspiration:
- Change the font size in your IDE to the smallest it will go and give yourself a headache as you solve today's puzzles while squinting
- Golf your solution
- Alternatively: gif
- Bonus points if your solution fits on a "punchcard" as defined in our wiki article on oversized code. We will be counting.
- Does anyone still program with actual punchcards? >_>
- Solve today's puzzles using
an Alien Programming LanguageAPL or other such extremely dense and compact programming language
Request from the mods: When you include an entry alongside your solution, please label it with [Red(dit) One] so we can find it easily!
--- Day 3: Lobby ---
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. What is Topaz'spastetool?
View all comments
2
u/RandomMangaFan Dec 03 '25
[LANGUAGE: Forth] [Red(dit) One] Gforth
Back once again with forth to produce yet another answer that (while it won't fit on a punched card (pedantry warning: it's called a punched card not a punchcard)) will fit in a 64 char and 16 line long screen on your 1980s era block editor.
This is nice and all, but if we do a bit of rearranging we can make this much smaller, and do away with that sneaky library. Now, I'll note that this is much harder to golf than it would be in a higher level language or especially an array oriented language with a bunch of funny symbols, because we have to write our own loops, and those loops can only be defined inside functions (long story), but the result still fits inside 8 lines, with room for a nice comment at the top:
If you look closely at it you'll notice one more thing... there are exactly 0 variables in this entire program! *(except for the line buffer) After all, ants have no pockets, so we need to be careful with what we're trying to make them carry.
Everything goes through the data stack (which never gets more than 8 numbers at a time, I think) or the return stack - which is used simultaneously for a couple important bits of info I need to shuffle around, for the loop indexing, and of course for returning from functions (or "words" in forth) like a stack is meant to be used. Only one/two magic numbers are used - that's the 101 used for the line buffer size. The 12 in front of bats is the number of batteries used, so to make a part 1 solution you may simply replace that with a 2, or indeed remove it and call the word with any battery count you want.
Finally, because there are no variables, I have nowhere to store the file id, so you'd have to manually duplicate it or run the program again to call the function again. Oh and the return stack shuffling causes some kind of error at the end of the function but it doesn't crash the program so it's probably fine (?)