--- 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
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
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]
- ]