From: Neil Smith Date: Sun, 29 Dec 2024 14:32:04 +0000 (+0000) Subject: Added links to blog posts X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=8bd03a64efa8d924fdd2838d6adc7ef51f008700;p=advent-of-code-24.git Added links to blog posts --- diff --git a/advent24/Main.hs b/advent24/Main.hs index 8359f35..ab75a2e 100644 --- a/advent24/Main.hs +++ b/advent24/Main.hs @@ -57,6 +57,7 @@ rdn = do part1 :: Wires -> Device -> Int part1 wires device = wiresOutput $ simulate wires device +part2 :: String part2 = intercalate "," $ sort ["vss", "z14", "kdh", "hjf", "z31", "kpp", "z35", "sgj"] diff --git a/advent25/Main.hs b/advent25/Main.hs index e5cedb9..9b1b919 100644 --- a/advent25/Main.hs +++ b/advent25/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-25/ import AoC @@ -25,13 +25,10 @@ compatible :: Schematic -> Schematic -> Bool compatible (Lock ls) (Key ks) = all (<= 5) $ zipWith (+) ls ks makeSchematics :: String -> ([Schematic], [Schematic]) -makeSchematics = partition isLock . fmap makeSchematic . splitTexts . lines +makeSchematics = partition isLock . fmap makeSchematic . splitOn [""] . lines where isLock (Lock _) = True isLock _ = False -splitTexts :: [String] -> [[String]] -splitTexts = splitOn [""] - makeSchematic :: [String] -> Schematic makeSchematic ss | isKeySchematic ss = Key $ heightsOf ss