From: Neil Smith Date: Sun, 31 Dec 2023 15:11:49 +0000 (+0000) Subject: Alternative use of both view X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=807aa171df85fc6ba54beaf1ac9acd4f6f2490e9;p=advent-of-code-23.git Alternative use of both view --- diff --git a/advent22/Main.hs b/advent22/Main.hs index 87bdf6c..a80afe4 100644 --- a/advent22/Main.hs +++ b/advent22/Main.hs @@ -63,9 +63,11 @@ dropBlocks blocks = foldl' dropBlock [] blocks dropBlock :: [Block] -> Block -> [Block] dropBlock resting block = resting ++ [over both (^-^ (V3 0 0 fallDistance)) block] - where _2xy = alongside _xy _xy - blockPlane = block ^. _2xy - under = filter ((intersectsXY blockPlane) . (view _2xy)) resting + where -- _2xy = alongside _xy _xy + -- blockPlane = block ^. _2xy + blockPlane = over both (view _xy) block + -- under = filter ((intersectsXY blockPlane) . (view _2xy)) resting + under = filter ((intersectsXY blockPlane) . (over both (view _xy))) resting highestUnder = maxZ under fallDistance = block ^. _1 . _z - highestUnder - 1