current difficulties
- Day 21 - Keypad Conundrum: 01h01m23s
- Day 17 - Chronospatial Computer: 44m39s
- Day 15 - Warehouse Woes: 30m00s
- Day 12 - Garden Groups: 17m42s
- Day 20 - Race Condition: 15m58s
- Day 14 - Restroom Redoubt: 15m48s
- Day 09 - Disk Fragmenter: 14m05s
- Day 16 - Reindeer Maze: 13m47s
- Day 22 - Monkey Market: 12m15s
- Day 13 - Claw Contraption: 11m04s
- Day 06 - Guard Gallivant: 08m53s
- Day 08 - Resonant Collinearity: 07m12s
- Day 11 - Plutonian Pebbles: 06m24s
- Day 18 - RAM Run: 05m55s
- Day 04 - Ceres Search: 05m41s
- Day 23 - LAN Party: 05m07s
- Day 02 - Red Nosed Reports: 04m42s
- Day 10 - Hoof It: 04m14s
- Day 07 - Bridge Repair: 03m47s
- Day 05 - Print Queue: 03m43s
- Day 03 - Mull It Over: 03m22s
- Day 19 - Linen Layout: 03m16s
- Day 01 - Historian Hysteria: 02m31s
I did end up writing a code solution.
algorithm desc
So basically the problem boils down to this:
A 1 bit full adder circuit with carry in/out is described as follows:
Si = Xi ^ Yi ^ Cini
Couti = (Xi && Yi) || (Cini && (Xi ^ Yi))
Where S is the output bit, X and Y are the input bits, and Cini is the carry out bit of bit i-1. For the first and last bits of the output, the circuits are slightly different due to carry in/out not mattering in the 0/last bit case.
Note that as said in the problem statement any input is correctly labelled, while outputs might be incorrect. You can then categorise each gate input/output as any of the elements in an adder circuit. You can then use set differences and intersections to determine the errors between categories. That’s all you need to do!
For example, you might have something like:
X && Y = err
if this output was used correctly, it should show up as an operand to an OR gate. So if you did:
(Set of all outputs of and gates) - (Set of all inputs to or gates), if something appears, then you know one of the and gates is wrong.
Just exhaustively find all the relevant differences and intersections and you’re done! To correct the circuit, you can then just brute force the 105 combinations of pair swaps to find what ends up correcting the circuit.