From: Neil Smith <NeilNjae@users.noreply.github.com>
Date: Sun, 29 Dec 2024 12:42:35 +0000 (+0000)
Subject: Added link to blog post
X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=63272b63f3deb697ffbe3cc282c6f01c956414d3;p=advent-of-code-24.git

Added link to blog post
---

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)