4 changed files with 512 additions and 57 deletions
@ -0,0 +1,118 @@ |
|||
--- Day 21: Keypad Conundrum --- |
|||
|
|||
As you teleport onto Santa's Reindeer-class starship, The Historians begin to panic: someone from their search party is missing. A quick life-form scan by the ship's computer reveals that when the missing Historian teleported, he arrived in another part of the ship. |
|||
|
|||
The door to that area is locked, but the computer can't open it; it can only be opened by physically typing the door codes (your puzzle input) on the numeric keypad on the door. |
|||
|
|||
The numeric keypad has four rows of buttons: 789, 456, 123, and finally an empty gap followed by 0A. Visually, they are arranged like this: |
|||
|
|||
+---+---+---+ |
|||
| 7 | 8 | 9 | |
|||
+---+---+---+ |
|||
| 4 | 5 | 6 | |
|||
+---+---+---+ |
|||
| 1 | 2 | 3 | |
|||
+---+---+---+ |
|||
| 0 | A | |
|||
+---+---+ |
|||
|
|||
Unfortunately, the area outside the door is currently depressurized and nobody can go near the door. A robot needs to be sent instead. |
|||
|
|||
The robot has no problem navigating the ship and finding the numeric keypad, but it's not designed for button pushing: it can't be told to push a specific button directly. Instead, it has a robotic arm that can be controlled remotely via a directional keypad. |
|||
|
|||
The directional keypad has two rows of buttons: a gap / ^ (up) / A (activate) on the first row and < (left) / v (down) / > (right) on the second row. Visually, they are arranged like this: |
|||
|
|||
+---+---+ |
|||
| ^ | A | |
|||
+---+---+---+ |
|||
| < | v | > | |
|||
+---+---+---+ |
|||
|
|||
When the robot arrives at the numeric keypad, its robotic arm is pointed at the A button in the bottom right corner. After that, this directional keypad remote control must be used to maneuver the robotic arm: the up / down / left / right buttons cause it to move its arm one button in that direction, and the A button causes the robot to briefly move forward, pressing the button being aimed at by the robotic arm. |
|||
|
|||
For example, to make the robot type 029A on the numeric keypad, one sequence of inputs on the directional keypad you could use is: |
|||
|
|||
< to move the arm from A (its initial position) to 0. |
|||
A to push the 0 button. |
|||
^A to move the arm to the 2 button and push it. |
|||
>^^A to move the arm to the 9 button and push it. |
|||
vvvA to move the arm to the A button and push it. |
|||
|
|||
In total, there are three shortest possible sequences of button presses on this directional keypad that would cause the robot to type 029A: <A^A>^^AvvvA, <A^A^>^AvvvA, and <A^A^^>AvvvA. |
|||
|
|||
Unfortunately, the area containing this directional keypad remote control is currently experiencing high levels of radiation and nobody can go near it. A robot needs to be sent instead. |
|||
|
|||
When the robot arrives at the directional keypad, its robot arm is pointed at the A button in the upper right corner. After that, a second, different directional keypad remote control is used to control this robot (in the same way as the first robot, except that this one is typing on a directional keypad instead of a numeric keypad). |
|||
|
|||
There are multiple shortest possible sequences of directional keypad button presses that would cause this robot to tell the first robot to type 029A on the door. One such sequence is v<<A>>^A<A>AvA<^AA>A<vAAA>^A. |
|||
|
|||
Unfortunately, the area containing this second directional keypad remote control is currently -40 degrees! Another robot will need to be sent to type on that directional keypad, too. |
|||
|
|||
There are many shortest possible sequences of directional keypad button presses that would cause this robot to tell the second robot to tell the first robot to eventually type 029A on the door. One such sequence is <vA<AA>>^AvAA<^A>A<v<A>>^AvA^A<vA>^A<v<A>^A>AAvA^A<v<A>A>^AAAvA<^A>A. |
|||
|
|||
Unfortunately, the area containing this third directional keypad remote control is currently full of Historians, so no robots can find a clear path there. Instead, you will have to type this sequence yourself. |
|||
|
|||
Were you to choose this sequence of button presses, here are all of the buttons that would be pressed on your directional keypad, the two robots' directional keypads, and the numeric keypad: |
|||
|
|||
<vA<AA>>^AvAA<^A>A<v<A>>^AvA^A<vA>^A<v<A>^A>AAvA^A<v<A>A>^AAAvA<^A>A |
|||
v<<A>>^A<A>AvA<^AA>A<vAAA>^A |
|||
<A^A>^^AvvvA |
|||
029A |
|||
|
|||
In summary, there are the following keypads: |
|||
|
|||
One directional keypad that you are using. |
|||
Two directional keypads that robots are using. |
|||
One numeric keypad (on a door) that a robot is using. |
|||
|
|||
It is important to remember that these robots are not designed for button pushing. In particular, if a robot arm is ever aimed at a gap where no button is present on the keypad, even for an instant, the robot will panic unrecoverably. So, don't do that. All robots will initially aim at the keypad's A key, wherever it is. |
|||
|
|||
To unlock the door, five codes will need to be typed on its numeric keypad. For example: |
|||
|
|||
029A |
|||
980A |
|||
179A |
|||
456A |
|||
379A |
|||
|
|||
For each of these, here is a shortest sequence of button presses you could type to cause the desired code to be typed on the numeric keypad: |
|||
|
|||
029A: <vA<AA>>^AvAA<^A>A<v<A>>^AvA^A<vA>^A<v<A>^A>AAvA^A<v<A>A>^AAAvA<^A>A |
|||
980A: <v<A>>^AAAvA^A<vA<AA>>^AvAA<^A>A<v<A>A>^AAAvA<^A>A<vA>^A<A>A |
|||
179A: <v<A>>^A<vA<A>>^AAvAA<^A>A<v<A>>^AAvA^A<vA>^AA<A>A<v<A>A>^AAAvA<^A>A |
|||
456A: <v<A>>^AA<vA<A>>^AAvAA<^A>A<vA>^A<A>A<vA>^A<A>A<v<A>A>^AAvA<^A>A |
|||
379A: <v<A>>^AvA^A<vA<AA>>^AAvA<^A>AAvA^A<vA>^AA<A>A<v<A>A>^AAAvA<^A>A |
|||
|
|||
The Historians are getting nervous; the ship computer doesn't remember whether the missing Historian is trapped in the area containing a giant electromagnet or molten lava. You'll need to make sure that for each of the five codes, you find the shortest sequence of button presses necessary. |
|||
|
|||
The complexity of a single code (like 029A) is equal to the result of multiplying these two values: |
|||
|
|||
The length of the shortest sequence of button presses you need to type on your directional keypad in order to cause the code to be typed on the numeric keypad; for 029A, this would be 68. |
|||
The numeric part of the code (ignoring leading zeroes); for 029A, this would be 29. |
|||
|
|||
In the above example, complexity of the five codes can be found by calculating 68 * 29, 60 * 980, 68 * 179, 64 * 456, and 64 * 379. Adding these together produces 126384. |
|||
|
|||
Find the fewest number of button presses you'll need to perform in order to cause the robot in front of the door to type each code. What is the sum of the complexities of the five codes on your list? |
|||
|
|||
Your puzzle answer was 211930. |
|||
--- Part Two --- |
|||
|
|||
Just as the missing Historian is released, The Historians realize that a second member of their search party has also been missing this entire time! |
|||
|
|||
A quick life-form scan reveals the Historian is also trapped in a locked area of the ship. Due to a variety of hazards, robots are once again dispatched, forming another chain of remote control keypads managing robotic-arm-wielding robots. |
|||
|
|||
This time, many more robots are involved. In summary, there are the following keypads: |
|||
|
|||
One directional keypad that you are using. |
|||
25 directional keypads that robots are using. |
|||
One numeric keypad (on a door) that a robot is using. |
|||
|
|||
The keypads form a chain, just like before: your directional keypad controls a robot which is typing on a directional keypad which controls a robot which is typing on a directional keypad... and so on, ending with the robot which is typing on the numeric keypad. |
|||
|
|||
The door codes are the same this time around; only the number of robots and directional keypads has changed. |
|||
|
|||
Find the fewest number of button presses you'll need to perform in order to cause the robot in front of the door to type each code. What is the sum of the complexities of the five codes on your list? |
|||
|
|||
Your puzzle answer was 263492840501566. |
|||
|
|||
Both parts of this puzzle are complete! They provide two gold stars: ** |
@ -0,0 +1,126 @@ |
|||
--- Day 22: Monkey Market --- |
|||
|
|||
As you're all teleported deep into the jungle, a monkey steals The Historians' device! You'll need to get it back while The Historians are looking for the Chief. |
|||
|
|||
The monkey that stole the device seems willing to trade it, but only in exchange for an absurd number of bananas. Your only option is to buy bananas on the Monkey Exchange Market. |
|||
|
|||
You aren't sure how the Monkey Exchange Market works, but one of The Historians senses trouble and comes over to help. Apparently, they've been studying these monkeys for a while and have deciphered their secrets. |
|||
|
|||
Today, the Market is full of monkeys buying good hiding spots. Fortunately, because of the time you recently spent in this jungle, you know lots of good hiding spots you can sell! If you sell enough hiding spots, you should be able to get enough bananas to buy the device back. |
|||
|
|||
On the Market, the buyers seem to use random prices, but their prices are actually only pseudorandom! If you know the secret of how they pick their prices, you can wait for the perfect time to sell. |
|||
|
|||
The part about secrets is literal, the Historian explains. Each buyer produces a pseudorandom sequence of secret numbers where each secret is derived from the previous. |
|||
|
|||
In particular, each buyer's secret number evolves into the next secret number in the sequence via the following process: |
|||
|
|||
Calculate the result of multiplying the secret number by 64. Then, mix this result into the secret number. Finally, prune the secret number. |
|||
Calculate the result of dividing the secret number by 32. Round the result down to the nearest integer. Then, mix this result into the secret number. Finally, prune the secret number. |
|||
Calculate the result of multiplying the secret number by 2048. Then, mix this result into the secret number. Finally, prune the secret number. |
|||
|
|||
Each step of the above process involves mixing and pruning: |
|||
|
|||
To mix a value into the secret number, calculate the bitwise XOR of the given value and the secret number. Then, the secret number becomes the result of that operation. (If the secret number is 42 and you were to mix 15 into the secret number, the secret number would become 37.) |
|||
To prune the secret number, calculate the value of the secret number modulo 16777216. Then, the secret number becomes the result of that operation. (If the secret number is 100000000 and you were to prune the secret number, the secret number would become 16113920.) |
|||
|
|||
After this process completes, the buyer is left with the next secret number in the sequence. The buyer can repeat this process as many times as necessary to produce more secret numbers. |
|||
|
|||
So, if a buyer had a secret number of 123, that buyer's next ten secret numbers would be: |
|||
|
|||
15887950 |
|||
16495136 |
|||
527345 |
|||
704524 |
|||
1553684 |
|||
12683156 |
|||
11100544 |
|||
12249484 |
|||
7753432 |
|||
5908254 |
|||
|
|||
Each buyer uses their own secret number when choosing their price, so it's important to be able to predict the sequence of secret numbers for each buyer. Fortunately, the Historian's research has uncovered the initial secret number of each buyer (your puzzle input). For example: |
|||
|
|||
1 |
|||
10 |
|||
100 |
|||
2024 |
|||
|
|||
This list describes the initial secret number of four different secret-hiding-spot-buyers on the Monkey Exchange Market. If you can simulate secret numbers from each buyer, you'll be able to predict all of their future prices. |
|||
|
|||
In a single day, buyers each have time to generate 2000 new secret numbers. In this example, for each buyer, their initial secret number and the 2000th new secret number they would generate are: |
|||
|
|||
1: 8685429 |
|||
10: 4700978 |
|||
100: 15273692 |
|||
2024: 8667524 |
|||
|
|||
Adding up the 2000th new secret number for each buyer produces 37327623. |
|||
|
|||
For each buyer, simulate the creation of 2000 new secret numbers. What is the sum of the 2000th secret number generated by each buyer? |
|||
|
|||
Your puzzle answer was 12664695565. |
|||
--- Part Two --- |
|||
|
|||
Of course, the secret numbers aren't the prices each buyer is offering! That would be ridiculous. Instead, the prices the buyer offers are just the ones digit of each of their secret numbers. |
|||
|
|||
So, if a buyer starts with a secret number of 123, that buyer's first ten prices would be: |
|||
|
|||
3 (from 123) |
|||
0 (from 15887950) |
|||
6 (from 16495136) |
|||
5 (etc.) |
|||
4 |
|||
4 |
|||
6 |
|||
4 |
|||
4 |
|||
2 |
|||
|
|||
This price is the number of bananas that buyer is offering in exchange for your information about a new hiding spot. However, you still don't speak monkey, so you can't negotiate with the buyers directly. The Historian speaks a little, but not enough to negotiate; instead, he can ask another monkey to negotiate on your behalf. |
|||
|
|||
Unfortunately, the monkey only knows how to decide when to sell by looking at the changes in price. Specifically, the monkey will only look for a specific sequence of four consecutive changes in price, then immediately sell when it sees that sequence. |
|||
|
|||
So, if a buyer starts with a secret number of 123, that buyer's first ten secret numbers, prices, and the associated changes would be: |
|||
|
|||
123: 3 |
|||
15887950: 0 (-3) |
|||
16495136: 6 (6) |
|||
527345: 5 (-1) |
|||
704524: 4 (-1) |
|||
1553684: 4 (0) |
|||
12683156: 6 (2) |
|||
11100544: 4 (-2) |
|||
12249484: 4 (0) |
|||
7753432: 2 (-2) |
|||
|
|||
Note that the first price has no associated change because there was no previous price to compare it with. |
|||
|
|||
In this short example, within just these first few prices, the highest price will be 6, so it would be nice to give the monkey instructions that would make it sell at that time. The first 6 occurs after only two changes, so there's no way to instruct the monkey to sell then, but the second 6 occurs after the changes -1,-1,0,2. So, if you gave the monkey that sequence of changes, it would wait until the first time it sees that sequence and then immediately sell your hiding spot information at the current price, winning you 6 bananas. |
|||
|
|||
Each buyer only wants to buy one hiding spot, so after the hiding spot is sold, the monkey will move on to the next buyer. If the monkey never hears that sequence of price changes from a buyer, the monkey will never sell, and will instead just move on to the next buyer. |
|||
|
|||
Worse, you can only give the monkey a single sequence of four price changes to look for. You can't change the sequence between buyers. |
|||
|
|||
You're going to need as many bananas as possible, so you'll need to determine which sequence of four price changes will cause the monkey to get you the most bananas overall. Each buyer is going to generate 2000 secret numbers after their initial secret number, so, for each buyer, you'll have 2000 price changes in which your sequence can occur. |
|||
|
|||
Suppose the initial secret number of each buyer is: |
|||
|
|||
1 |
|||
2 |
|||
3 |
|||
2024 |
|||
|
|||
There are many sequences of four price changes you could tell the monkey, but for these four buyers, the sequence that will get you the most bananas is -2,1,-1,3. Using that sequence, the monkey will make the following sales: |
|||
|
|||
For the buyer with an initial secret number of 1, changes -2,1,-1,3 first occur when the price is 7. |
|||
For the buyer with initial secret 2, changes -2,1,-1,3 first occur when the price is 7. |
|||
For the buyer with initial secret 3, the change sequence -2,1,-1,3 does not occur in the first 2000 changes. |
|||
For the buyer starting with 2024, changes -2,1,-1,3 first occur when the price is 9. |
|||
|
|||
So, by asking the monkey to sell the first time each buyer's prices go down 2, then up 1, then down 1, then up 3, you would get 23 (7 + 7 + 9) bananas! |
|||
|
|||
Figure out the best sequence to tell the monkey so that by looking for that same sequence of changes in every buyer's future prices, you get the most bananas in total. What is the most bananas you can get? |
|||
|
|||
Your puzzle answer was 1444. |
|||
|
|||
Both parts of this puzzle are complete! They provide two gold stars: ** |
@ -0,0 +1,200 @@ |
|||
--- Day 24: Crossed Wires --- |
|||
|
|||
You and The Historians arrive at the edge of a large grove somewhere in the jungle. After the last incident, the Elves installed a small device that monitors the fruit. While The Historians search the grove, one of them asks if you can take a look at the monitoring device; apparently, it's been malfunctioning recently. |
|||
|
|||
The device seems to be trying to produce a number through some boolean logic gates. Each gate has two inputs and one output. The gates all operate on values that are either true (1) or false (0). |
|||
|
|||
AND gates output 1 if both inputs are 1; if either input is 0, these gates output 0. |
|||
OR gates output 1 if one or both inputs is 1; if both inputs are 0, these gates output 0. |
|||
XOR gates output 1 if the inputs are different; if the inputs are the same, these gates output 0. |
|||
|
|||
Gates wait until both inputs are received before producing output; wires can carry 0, 1 or no value at all. There are no loops; once a gate has determined its output, the output will not change until the whole system is reset. Each wire is connected to at most one gate output, but can be connected to many gate inputs. |
|||
|
|||
Rather than risk getting shocked while tinkering with the live system, you write down all of the gate connections and initial wire values (your puzzle input) so you can consider them in relative safety. For example: |
|||
|
|||
x00: 1 |
|||
x01: 1 |
|||
x02: 1 |
|||
y00: 0 |
|||
y01: 1 |
|||
y02: 0 |
|||
|
|||
x00 AND y00 -> z00 |
|||
x01 XOR y01 -> z01 |
|||
x02 OR y02 -> z02 |
|||
|
|||
Because gates wait for input, some wires need to start with a value (as inputs to the entire system). The first section specifies these values. For example, x00: 1 means that the wire named x00 starts with the value 1 (as if a gate is already outputting that value onto that wire). |
|||
|
|||
The second section lists all of the gates and the wires connected to them. For example, x00 AND y00 -> z00 describes an instance of an AND gate which has wires x00 and y00 connected to its inputs and which will write its output to wire z00. |
|||
|
|||
In this example, simulating these gates eventually causes 0 to appear on wire z00, 0 to appear on wire z01, and 1 to appear on wire z02. |
|||
|
|||
Ultimately, the system is trying to produce a number by combining the bits on all wires starting with z. z00 is the least significant bit, then z01, then z02, and so on. |
|||
|
|||
In this example, the three output bits form the binary number 100 which is equal to the decimal number 4. |
|||
|
|||
Here's a larger example: |
|||
|
|||
x00: 1 |
|||
x01: 0 |
|||
x02: 1 |
|||
x03: 1 |
|||
x04: 0 |
|||
y00: 1 |
|||
y01: 1 |
|||
y02: 1 |
|||
y03: 1 |
|||
y04: 1 |
|||
|
|||
ntg XOR fgs -> mjb |
|||
y02 OR x01 -> tnw |
|||
kwq OR kpj -> z05 |
|||
x00 OR x03 -> fst |
|||
tgd XOR rvg -> z01 |
|||
vdt OR tnw -> bfw |
|||
bfw AND frj -> z10 |
|||
ffh OR nrd -> bqk |
|||
y00 AND y03 -> djm |
|||
y03 OR y00 -> psh |
|||
bqk OR frj -> z08 |
|||
tnw OR fst -> frj |
|||
gnj AND tgd -> z11 |
|||
bfw XOR mjb -> z00 |
|||
x03 OR x00 -> vdt |
|||
gnj AND wpb -> z02 |
|||
x04 AND y00 -> kjc |
|||
djm OR pbm -> qhw |
|||
nrd AND vdt -> hwm |
|||
kjc AND fst -> rvg |
|||
y04 OR y02 -> fgs |
|||
y01 AND x02 -> pbm |
|||
ntg OR kjc -> kwq |
|||
psh XOR fgs -> tgd |
|||
qhw XOR tgd -> z09 |
|||
pbm OR djm -> kpj |
|||
x03 XOR y03 -> ffh |
|||
x00 XOR y04 -> ntg |
|||
bfw OR bqk -> z06 |
|||
nrd XOR fgs -> wpb |
|||
frj XOR qhw -> z04 |
|||
bqk OR frj -> z07 |
|||
y03 OR x01 -> nrd |
|||
hwm AND bqk -> z03 |
|||
tgd XOR rvg -> z12 |
|||
tnw OR pbm -> gnj |
|||
|
|||
After waiting for values on all wires starting with z, the wires in this system have the following values: |
|||
|
|||
bfw: 1 |
|||
bqk: 1 |
|||
djm: 1 |
|||
ffh: 0 |
|||
fgs: 1 |
|||
frj: 1 |
|||
fst: 1 |
|||
gnj: 1 |
|||
hwm: 1 |
|||
kjc: 0 |
|||
kpj: 1 |
|||
kwq: 0 |
|||
mjb: 1 |
|||
nrd: 1 |
|||
ntg: 0 |
|||
pbm: 1 |
|||
psh: 1 |
|||
qhw: 1 |
|||
rvg: 0 |
|||
tgd: 0 |
|||
tnw: 1 |
|||
vdt: 1 |
|||
wpb: 0 |
|||
z00: 0 |
|||
z01: 0 |
|||
z02: 0 |
|||
z03: 1 |
|||
z04: 0 |
|||
z05: 1 |
|||
z06: 1 |
|||
z07: 1 |
|||
z08: 1 |
|||
z09: 1 |
|||
z10: 1 |
|||
z11: 0 |
|||
z12: 0 |
|||
|
|||
Combining the bits from all wires starting with z produces the binary number 0011111101000. Converting this number to decimal produces 2024. |
|||
|
|||
Simulate the system of gates and wires. What decimal number does it output on the wires starting with z? |
|||
|
|||
Your puzzle answer was 53755311654662. |
|||
--- Part Two --- |
|||
|
|||
After inspecting the monitoring device more closely, you determine that the system you're simulating is trying to add two binary numbers. |
|||
|
|||
Specifically, it is treating the bits on wires starting with x as one binary number, treating the bits on wires starting with y as a second binary number, and then attempting to add those two numbers together. The output of this operation is produced as a binary number on the wires starting with z. (In all three cases, wire 00 is the least significant bit, then 01, then 02, and so on.) |
|||
|
|||
The initial values for the wires in your puzzle input represent just one instance of a pair of numbers that sum to the wrong value. Ultimately, any two binary numbers provided as input should be handled correctly. That is, for any combination of bits on wires starting with x and wires starting with y, the sum of the two numbers those bits represent should be produced as a binary number on the wires starting with z. |
|||
|
|||
For example, if you have an addition system with four x wires, four y wires, and five z wires, you should be able to supply any four-bit number on the x wires, any four-bit number on the y numbers, and eventually find the sum of those two numbers as a five-bit number on the z wires. One of the many ways you could provide numbers to such a system would be to pass 11 on the x wires (1011 in binary) and 13 on the y wires (1101 in binary): |
|||
|
|||
x00: 1 |
|||
x01: 1 |
|||
x02: 0 |
|||
x03: 1 |
|||
y00: 1 |
|||
y01: 0 |
|||
y02: 1 |
|||
y03: 1 |
|||
|
|||
If the system were working correctly, then after all gates are finished processing, you should find 24 (11+13) on the z wires as the five-bit binary number 11000: |
|||
|
|||
z00: 0 |
|||
z01: 0 |
|||
z02: 0 |
|||
z03: 1 |
|||
z04: 1 |
|||
|
|||
Unfortunately, your actual system needs to add numbers with many more bits and therefore has many more wires. |
|||
|
|||
Based on forensic analysis of scuff marks and scratches on the device, you can tell that there are exactly four pairs of gates whose output wires have been swapped. (A gate can only be in at most one such pair; no gate's output was swapped multiple times.) |
|||
|
|||
For example, the system below is supposed to find the bitwise AND of the six-bit number on x00 through x05 and the six-bit number on y00 through y05 and then write the result as a six-bit number on z00 through z05: |
|||
|
|||
x00: 0 |
|||
x01: 1 |
|||
x02: 0 |
|||
x03: 1 |
|||
x04: 0 |
|||
x05: 1 |
|||
y00: 0 |
|||
y01: 0 |
|||
y02: 1 |
|||
y03: 1 |
|||
y04: 0 |
|||
y05: 1 |
|||
|
|||
x00 AND y00 -> z05 |
|||
x01 AND y01 -> z02 |
|||
x02 AND y02 -> z01 |
|||
x03 AND y03 -> z03 |
|||
x04 AND y04 -> z04 |
|||
x05 AND y05 -> z00 |
|||
|
|||
However, in this example, two pairs of gates have had their output wires swapped, causing the system to produce wrong answers. The first pair of gates with swapped outputs is x00 AND y00 -> z05 and x05 AND y05 -> z00; the second pair of gates is x01 AND y01 -> z02 and x02 AND y02 -> z01. Correcting these two swaps results in this system that works as intended for any set of initial values on wires that start with x or y: |
|||
|
|||
x00 AND y00 -> z00 |
|||
x01 AND y01 -> z01 |
|||
x02 AND y02 -> z02 |
|||
x03 AND y03 -> z03 |
|||
x04 AND y04 -> z04 |
|||
x05 AND y05 -> z05 |
|||
|
|||
In this example, two pairs of gates have outputs that are involved in a swap. By sorting their output wires' names and joining them with commas, the list of wires involved in swaps is z00,z01,z02,z05. |
|||
|
|||
Of course, your actual system is much more complex than this, and the gates that need their outputs swapped could be anywhere, not just attached to a wire starting with z. If you were to determine that you need to swap output wires aaa with eee, ooo with z99, bbb with ccc, and aoc with z24, your answer would be aaa,aoc,bbb,ccc,eee,ooo,z24,z99. |
|||
|
|||
Your system of gates and wires has four pairs of gates which need their output wires swapped - eight wires in total. Determine which four pairs of gates need their outputs swapped so that your system correctly performs addition; what do you get if you sort the names of the eight wires involved in a swap and then join those names with commas? |
|||
|
|||
Your puzzle answer was dkr,ggk,hhh,htp,rhv,z05,z15,z20. |
|||
|
|||
Both parts of this puzzle are complete! They provide two gold stars: ** |
Loading…
Reference in new issue