From: Neil Smith Date: Tue, 24 Dec 2024 15:24:07 +0000 (+0000) Subject: Added link to blog post X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=0146ade18fbb8fd40544a5842a2e132a2c767418;p=advent-of-code-24.git Added link to blog post --- diff --git a/advent22/Main.hs b/advent22/Main.hs index 39657a1..7fe439d 100644 --- a/advent22/Main.hs +++ b/advent22/Main.hs @@ -1,8 +1,8 @@ --- Writeup at https://work.njae.me.uk/2024/12/24/advent-of-code-2024-day-21/ +-- Writeup at https://work.njae.me.uk/2024/12/24/advent-of-code-2024-day-22/ import AoC import Data.Bits -import Data.List +-- import Data.List import Data.List.Split import qualified Data.IntMap.Strict as M @@ -18,7 +18,7 @@ main = print $ part1 codes print $ part2 codes -part1 :: [Int] -> Int +part1, part2 :: [Int] -> Int part1 codes = sum $ fmap (followingSecret 2000) codes part2 codes = maximum $ M.elems mergedPriceValues @@ -55,12 +55,3 @@ windowsAndPrices :: [Int] -> Prices windowsAndPrices ps = foldl' (\m (w, p) -> M.insertWith (flip const) w p m) M.empty wPs where cs = priceChanges ps wPs = zip (windows cs) (drop 4 ps) - - -possibleWindows :: [[Int]] -possibleWindows = [ [a, b, c, d] - | a <- [-9..9] - , b <- [-9..9] - , c <- [-9..9] - , d <- [-9..9] - ] diff --git a/advent22/MainBruteForce.hs b/advent22/MainBruteForce.hs index 53156da..7e03903 100644 --- a/advent22/MainBruteForce.hs +++ b/advent22/MainBruteForce.hs @@ -1,4 +1,4 @@ --- Writeup at https://work.njae.me.uk/2024/12/24/advent-of-code-2024-day-21/ +-- Writeup at https://work.njae.me.uk/2024/12/24/advent-of-code-2024-day-22/ import AoC import Data.Bits