From f7352d970e4252d0fdf6719349255ab010efcf69 Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Fri, 22 Dec 2023 09:19:55 -0600 Subject: [PATCH] wibble --- solutions/src/2023/22.hs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/solutions/src/2023/22.hs b/solutions/src/2023/22.hs index 794a44d..719a40a 100644 --- a/solutions/src/2023/22.hs +++ b/solutions/src/2023/22.hs @@ -40,14 +40,10 @@ import Data.Ord (comparing) main :: IO () main = do input <- [format|2023 22 (%d,%d,%d~%d,%d,%d%n)*|] - let bricks = map toBrick input - let sunk = lowerAll bricks - let support = runEval (parList rseq [countFalls xs | (_,xs) <- pickOne sunk]) - print (count 0 support) - print (sum support) - -countSupported :: [Box' 3] -> Box' 3 -> Int -countSupported bricks brick = countFalls (delete brick bricks) + let sunk = lowerAll (map toBrick input) + falls = runEval (parList rseq [countFalls xs | (_,xs) <- pickOne sunk]) + print (count 0 falls) + print (sum falls) lowerAll :: [Box' 3] -> [Box' 3] lowerAll = foldl lowerOne [] . sort