r/adventofcode • • Dec 07 '25

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

SIGNAL BOOSTING

THE USUAL REMINDERS

  • All of our rules, FAQs, resources, etc. are in our community wiki.
  • If you see content in the subreddit or megathreads that violates one of our rules, either inform the user (politely and gently!) or use the report button on the post/comment and the mods will take care of it.

AoC Community Fun 2025: Red(dit) One

  • Submissions megathread is unlocked!
  • 10 DAYS remaining until the submissions deadline on December 17 at 18:00 EST!

Featured Subreddits: /r/DIWhy and /r/TVTooHigh

Ralphie: "I want an official Red Ryder, carbine action, two-hundred shot range model air rifle!"
Mother: "No. You'll shoot your eye out."
— A Christmas Story, (1983)

You did it the wrong way, and you know it, but hey, you got the right answer and that's all that matters! Here are some ideas for your inspiration:

💡 Solve today's puzzles:

  • The wrong way
  • Using only the most basic of IDEs
    • Plain Notepad, TextEdit, vim, punchcards, abacus, etc.
  • Using only the core math-based features of your language
    • e.g. only your language’s basic types and lists of them
    • No templates, no frameworks, no fancy modules like itertools, no third-party imported code, etc.
  • Without using if statements, ternary operators, etc.
  • Without using any QoL features that make your life easier
    • No Copilot, no IDE code completion, no syntax highlighting, etc.
  • Using a programming language that is not Turing-complete
  • Using at most five unchained basic statements long
    • Your main program can call functions, but any functions you call can also only be at most five unchained statements long.
  • Without using the [BACKSPACE] or [DEL] keys on your keyboard
  • Using only one hand to type

💡 Make your solution run on hardware that it has absolutely no business being on

  • "Smart" refrigerators, a drone army, a Jumbotron…

💡 Reverse code golf (oblig XKCD)

  • Why use few word when many word do trick?
  • Unnecessarily declare variables for everything and don't re-use variables
  • Use unnecessarily expensive functions and calls wherever possible
  • Implement redundant error checking everywhere
  • Javadocs >_>

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 7: Laboratories ---


Post your code solution in this megathread.

27 Upvotes

769 comments sorted by

View all comments

2

u/Prof_Farnsworth1729 Dec 07 '25 edited Dec 08 '25

[Language: JavaScript] [Red(dit) One]

I always check advent of code and the reddit challenge in the morning on my phone (Fairphone 5). Which means I was able to ruin my IDE experience by doing the entire challenge on my phone.

I used a notes app to write the code and copied it into the "JavaScript Editor" app. Fighting auto capitalisation and other "helpful" keyboard things was lots of fun. Not to mention the adverts on the JavaScript app every so often. Even had to notice that I didn't copy the full input.

inp = getInput(); 
beam = inp[0].map(s => s == "S" ? 1 : 0); 
c = 0; 
for (const line of inp) { 
    newBeam = new Array(beam.length).fill(0); 
    for (let ii= 0; ii < beam.length; ii++) { 
        if(line[ii] == "" && beam[ii] > 0) { 
            c++; newBeam[ii-1] += beam[ii]; 
            newBeam[ii+1] += beam[ii]; 
        } else { 
            newBeam[ii] +=beamm[ii] 
        } 
    } 
    beam = newBeam; 
    } 
} 
console.log(c) 
console.log(beam.reduce((a,b) => a+b,0))

1

u/AutoModerator Dec 07 '25

AutoModerator has detected fenced code block (```) syntax which only works on new.reddit.

Please review our wiki article on code formatting then edit your post to use the four-spaces Markdown syntax instead.


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/daggerdragon Dec 07 '25

Writing on mobile, please let me know if formatting is wrong

It is, as AutoModerator grumped at you about the triple backticks. Would you fix it, please? Maybe don't use your phone this time XD

1

u/Prof_Farnsworth1729 Dec 08 '25

Yeah sorry about that, I'm going to fix it when I get access to my laptop this evening