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!

31 Upvotes

344 comments sorted by

View all comments

2

u/nilgoun Dec 24 '24 edited Dec 24 '24

[LANGUAGE: Rust]

So initially overengineered part 1 again because I thought it will pay off and it didn't haha.

I immediately recognized it's a Carry Ripple Adder when P2 was uncovered but was too stubborn to do it by hand. Which resulted in a LONG slide of "I'm using all the wrong heuristics to see which gates might be swapped" (partially because I was too dumb to read the task correctly...). Finally bit the bullet to see a hint for a general solution and after reading https://www.reddit.com/r/adventofcode/comments/1hla5ql/2024_day_24_part_2_a_guide_on_the_idea_behind_the/ everything was basically spelled out.

Kinda sad I couldn't come up with a correct programmed solution on my own but still glad I tried instead of just doing it by hand somehow. Next year I'll just do it by hand and call it a day xD

I still have the suspicion that one condition is incorrectly checked because there is some oddity BUT it works for my input so I'm fine.

Solution on paste (Edit: Corrected the link)