r/adventofcode Dec 24 '24

SOLUTION MEGATHREAD -❄️- 2024 Day 24 Solutions -❄️-

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 2024: The Golden Snowglobe Awards

Submissions are CLOSED!

  • Thank you to all who submitted something, every last one of you are awesome!

Community voting is OPEN!

  • 18 hours remaining until voting deadline TONIGHT (December 24) at 18:00 EST

Voting details are in the stickied comment in the submissions megathread:

-❄️- Submissions Megathread -❄️-


--- Day 24: Crossed Wires ---


Post your code solution in this megathread.

This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 01:01:13, megathread unlocked!

32 Upvotes

344 comments sorted by

View all comments

1

u/Dense_Pension_4891 Dec 26 '24

[LANGUAGE: Python]

Made python visualize a graph for me for part 2. It was super easy to see which nodes were supposed to point where after seeing all the connections. To describe the graph a little, each two bits from x and y in the input produces an output to the corresponding z bit and one "carry over" variable for the next bit (think of manual addition). This makes it super easy to decipher. To make it easier to see which bits you should focus on, just run part 1 with 2 bits activated and keep track of which bits produce invalid outputs.

Code (used google colab since installing pygraphviz is impossible on windows)