Advent of Code 2024 Day 24 (BaseA Style)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Discussion thread for day 24 of the Advent of Code - https://adventofcode.com/2024/day/24
- Labels:
- Advent of Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Day 24. More in spoiler
P2: This took a long time to figure out. I ended up breaking the data into four categories that had out-of-place keys instead of trying to brute force or find the sums:
a. Ends With Z and doesn't contain XOR (this is needed for flexibility). These Z records are out of place
b. Starts with X or Y with XOR operation feeding into key result has to lead to 'AND' or 'XOR'. If this rule isn't met, they are out of place
c. Doesn't End in Z, Isn't Fed by X or Y, and ends in XOR. These second wave keys need to be AND/OR. If the rules aren't met they are out of place
d. Starts with X or Y with AND operation and doesn't feed into second-wave OR. Keys not meeting this rule are out of place
These four rules got me the eight keys out of place. I did it parts then took breaks and came back
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I will only post PART 2.
The workflow for PART 1 was lost while I was working on PART 2...
My workflow does not automatically replace wires.
I have manually replaced them 4 times.
Part2.
As the problem statement says, this is a logic circuit (adder).
My graduate major was semiconductor devices, but it is difficult to understand how this works.
So, I used Alteryx and "Pen and Paper" to figure out how the circuit works.
Then we can see that the circuit looks like the macro image.
x00 XOR y00 -> z00
x00 AND y00 -> AA
x01 XOR y01 -> BB
AA XOR BB -> z01
AA AND BB -> CC
x01 and y01 -> DD
CC AND DD -> EE
It goes on like this...(It's hard to explain.)
I made this into a workflow and identified four places where the workflow stopped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
P2 was difficult.
For P1, all output parameter was set as the main flow within the iterative macro. In each loop, the unknown parameters were determined step by step.
P2 was particularly challenging. Following the advice of my colleague, @Tokimatsu , Network Visualization Tool was used to identify problematic patterns visually. Among the four swapped pairs, three were easy to find because the output to z was not from XOR. For the last pair, I searched for inputs to z that were from neither XOR nor OR. This required a visual check and validated by adding the binary numbers from X and Y resulted in Z.
The Network Visualization Tool can visually highlight problems. Differentiating using direction, color, and size made the process much clearer. Additionally, thanks to @Tokimatsu's advice, gate names are included in the labels, which significantly improved clarity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Solved!
Part 1
In Part 2, in order to understand what was wrong, I used a batch macro to input 1s one bit at a time from the bottom and observed how the output changed.
This helped me to figure out where was wrong.
This means z4,5,10,11,22,23,37 are something wrong!
I also thought there should be something wrong with the internal wires, so I checked the bits of all of the wires as well.
This gave me a rough idea of ​​what was wrong, and I was able to identify what was wrong and manually find the answer.
Part 2
Part 2 macro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Part 1 here was fairly quick and easy... Part 2 was a BEAST! This involved lots of research into circuit adders to better understand how things SHOULD be working. I built out a test macro to check for the first break point where a problem existed and therefore wires were "crossed" in that area that needed swapping. Shout out to @DaisukeTsuchiya for the hint of using the Network Analysis tool to better visualize what was going on. Using my "next error" check macro along with this viz, and updating pairs one at a time until the circuit produced the proper output allowed me to quickly identify and sort out the circuit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Part 1 was relatively easy. An iterative macro is perfect for evaluating all logic. Part 2, as others have said, is very easy to make very difficult. I knew the general vicinity of all errored outputs within an hour, then proceeded to take the next day trying to wrap my head around finding the specific answer. Knowing how circuits work with boolean logic will be a tremendous asset although I still struggled to build with Alteryx. This was a very manual problem for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
At first I answered Part2 by looking at the network diagram. After that, I created a workflow to derive the answer to part 2 from the relationship between the operators. However, other people's data may not give the correct answer.
X(n) AND Y(n) = AND1(n)
X(n) XOR Y(n) = XOR1(n)
OR(n-1) XOR XOR1(n) = XOR2(n) = Z(n)
OR(n-1) AND XOR1(n) = AND2(n)
AND1(n) OR AND2(n) = OR(n)
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
take days for me.
i found answer via other solution but i not satisfy with the explanation.
so i spend some time to find a different way.
list x + list y = list z. it mean adding in the via "0101" in computer world
so, the method should be same for each digit. except for first 2 digits.
manual create excel and found the pattern, eyeball to catch the error.
and only need to search within the pillar, i.e. if 1 error found in z39, so another should be in z39 as well.
