--- Writeup at https://work.njae.me.uk/2024/12/29/advent-of-code-2024-day-24/
+-- Writeup of the original manual version at https://work.njae.me.uk/2024/12/29/advent-of-code-2024-day-24/
+-- Writeup of this version at https://work.njae.me.uk/2025/01/10/advent-of-code-2024-day-24-revisited/
import AoC
type Wires = M.Map String Int
-data GateType = And | Or | Xor | Carry | Output
+data GateType = And | Or | Xor | Carry
deriving (Show, Eq, Ord)
data Gate = Gate { gType :: GateType, inputs :: [String], output :: String }
Or -> (wires M.! i1) .|. (wires M.! i2)
Xor -> (wires M.! i1) `xor` (wires M.! i2)
Carry -> error "Carry not implemented"
- Output -> error "Output not implemented"
isOutputWire :: String -> Bool
isOutputWire (x:_) = x == 'z'
--- Writeup at https://work.njae.me.uk/2024/12/29/advent-of-code-2024-day-24/
+-- Writeup of the original manual version at https://work.njae.me.uk/2024/12/29/advent-of-code-2024-day-24/
+-- Writeup of this version at https://work.njae.me.uk/2025/01/10/advent-of-code-2024-day-24-revisited/
import AoC