--- Writeup at https://work.njae.me.uk/2024/12/25/advent-of-code-2024-day-23/
+-- Writeup at https://work.njae.me.uk/2024/12/29/advent-of-code-2024-day-24/
import AoC
wiresOutput :: Wires -> Int
wiresOutput wires = M.foldlWithKey' go 0 outWires
where outWires = M.filterWithKey (\k _ -> isOutputWire k) wires
- outShift w = read $ drop 1 w
- go acc w v = acc .|. (v .<<. outShift w)
+ -- outShift w = read $ drop 1 w
+ -- go acc w v = acc .|. (v .<<. outShift w)
+ go acc w v = acc .|. (v .<<. codeOfName w)
unfoldFromWire :: Device -> String -> DeviceTree
unfoldFromWire device wire =
d4 = renameWire "and00" "carry00" d3
d5 = foldl renameCarry d4 [1..44]
-stf tree = putStrLn $ unlines $ take 15 $ lines $ drawTree $ fmap show tree
-
-
-- parse the input file
wiresDeviceP :: Parser (Wires, Device)