This commit is contained in:
2023-12-22 13:06:56 +01:00
parent b48a12c5cc
commit ee37670cb3
5 changed files with 115 additions and 0 deletions

13
day22/Part1.hs Normal file
View File

@@ -0,0 +1,13 @@
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