projects
/
advent-of-code-23.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5e886d8
)
Alternative use of both view
author
Neil Smith
<NeilNjae@users.noreply.github.com>
Sun, 31 Dec 2023 15:11:49 +0000
(15:11 +0000)
committer
Neil Smith
<NeilNjae@users.noreply.github.com>
Sun, 31 Dec 2023 15:11:49 +0000
(15:11 +0000)
advent22/Main.hs
patch
|
blob
|
history
diff --git
a/advent22/Main.hs
b/advent22/Main.hs
index 87bdf6cb0b834c2cbd0d6cb577e28c41a49e1d1b..a80afe48cc59bebddcfaa34579cc5528c903f340 100644
(file)
--- 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]
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
highestUnder = maxZ under
fallDistance = block ^. _1 . _z - highestUnder - 1