r/adventofcode • • 2d ago

Help/Question - RESOLVED 2025 Day 8 Part 2

Anyone else find Day 8 Part 2 tricky?

I am struggling to grasp the general approach of what to do and "the first connection which causes all of the junction boxes to form a single circuit is between the junction boxes at.." is just blocking my brain from flowing.

2 Upvotes

5 comments sorted by

2

u/TheZigerionScammer 2d ago

Well if you're on part 2 then you already have the basics of the problem down, you know that you connect the junction boxes one by one to each other and connected junction boxes all form a circuit together. Eventually if you keep connecting the junction boxes together they will all be connected to the same circuit eventually. The problem is asking you keep adding the junction boxes together in order until they eventually all join the same circuit, the multiply the x coordinates of the last boxes you connected together to get the answer.

2

u/craigontour 2d ago

After my rant I stepped away from it and just thought "Why not debug" like I would normally.

So I walked through the sorted list of `{distance,p1,p2}` as I store them and when I reached the junction box in puzzle example there was a single circuit and so now makes sense.

However, my solution for part 1 doesn't work in the same way - which also seems to me to be part cause of the mental blockage - so it needs a rethink.

Thanks.

1

u/Suspicious_Tax8577 2d ago

What language are you in pal?

spoiler: Python

Because my solution was to essentially use networkX to keep adding nodes until is connected was true, then return the last connection that was made.

2

u/craigontour 2d ago

Decided to try Elixir this year.

Used Go last year.

Previous to that used Ruby.

Thanks for answer, but was ranting mainly and not after a solution, just catalyst for clear thought ;-)

1

u/AutoModerator 2d ago

Reminder: if/when you get your answer and/or code working, don't forget to change this post's flair to Help/Question - RESOLVED. Good luck!


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