Skip to content

Commit

Permalink
wibble
Browse files Browse the repository at this point in the history
  • Loading branch information
glguy committed Dec 22, 2023
1 parent 2269d03 commit f7352d9
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions solutions/src/2023/22.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f7352d9

Please sign in to comment.