projects
/
advent-of-code-19.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5571128
)
Removed needless scanning of each column
author
Neil Smith
<neil.git@njae.me.uk>
Sat, 4 Jan 2020 12:58:48 +0000
(12:58 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Sat, 4 Jan 2020 12:58:48 +0000
(12:58 +0000)
advent19/src/advent19.hs
patch
|
blob
|
history
diff --git
a/advent19/src/advent19.hs
b/advent19/src/advent19.hs
index 7543513837c4096960dfe2fea3d6d22e5f5c31b6..0cf73eec571b006ae66d6fe12ddbaae48d8016cb 100644
(file)
--- a/
advent19/src/advent19.hs
+++ b/
advent19/src/advent19.hs
@@
-76,8
+76,8
@@
traceUpper machine prev x = u'
traceLower :: Machine -> (Integer, Integer) -> Integer -> (Integer, Integer)
traceLower machine (_, prev) x = (x, l')
where (bic, foundU) = beamInColumn machine x
- start
U = max prev foundU
- l = head $ dropWhile (\y -> tractorBeamAt machine x y) [start
U
..]
+ start
L = if prev == 0 then foundU else prev
+ l = head $ dropWhile (\y -> tractorBeamAt machine x y) [start
L
..]
l' = if prev == 0 && bic == False
then 0
else l - 1