Files
advent-of-code-2023/day22/Part1.hs
2023-12-22 13:11:09 +01:00

14 lines
408 B
Haskell

module Part1 where
import Commons
import qualified Data.Map.Strict as M
import qualified Data.Set as S
canDestroy :: Snapshot -> Brick -> Bool
canDestroy s b = let newSnapshot = M.difference s $ M.fromList $ map (\ c -> ((z c, y c, x c), b)) b
in null $ getFalling newSnapshot
getDestroyables :: Snapshot -> S.Set Brick
getDestroyables s = S.fromList $ filter (canDestroy s) $ M.elems s