Day 22
This commit is contained in:
13
day22/Part1.hs
Normal file
13
day22/Part1.hs
Normal 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
|
||||
Reference in New Issue
Block a user