From 63272b63f3deb697ffbe3cc282c6f01c956414d3 Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Sun, 29 Dec 2024 12:42:35 +0000 Subject: [PATCH] Added link to blog post --- advent24/Main.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/advent24/Main.hs b/advent24/Main.hs index 17c5266..8359f35 100644 --- a/advent24/Main.hs +++ b/advent24/Main.hs @@ -1,4 +1,4 @@ --- 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 @@ -87,8 +87,9 @@ isOutputWire (x:_) = x == 'z' 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 = @@ -214,9 +215,6 @@ renamings device = d5 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) -- 2.34.1