14 lines
408 B
Haskell
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
|