summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-12-13 09:47:32 +0100
committertomsmeding <tom.smeding@gmail.com>2019-12-13 09:47:32 +0100
commit72b0a55c2ae0076dc3138a1c35af1bf798aa7bab (patch)
tree778c59733200cf6edd941c2f5432bc1e9531f221
parent9033932bc84539b495074f809a134881bc00b92c (diff)
IntCode: fix bug in address resolving introduced in infinite-mem
-rw-r--r--2019/IntCode.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/2019/IntCode.hs b/2019/IntCode.hs
index 2096bcc..8d180bf 100644
--- a/2019/IntCode.hs
+++ b/2019/IntCode.hs
@@ -172,7 +172,7 @@ runArray arr ptr inp offset = do
resolve (Addr n) = do
(_, right) <- SA.getBounds arr
let n' = fromIntegral n
- if n' >= right then return 0 else SA.readArray arr n'
+ if n' > right then return 0 else SA.readArray arr n'
resolve (Imm n) = return n
resolve (Rel n) = resolve (Addr (fromIntegral offset + n))
resolveAddr (Addr n) = n