summaryrefslogtreecommitdiff
path: root/interpreter.hs
diff options
context:
space:
mode:
Diffstat (limited to 'interpreter.hs')
-rw-r--r--interpreter.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/interpreter.hs b/interpreter.hs
index 59b9402..4f3f3aa 100644
--- a/interpreter.hs
+++ b/interpreter.hs
@@ -23,10 +23,9 @@ interInss !count !tape !memp allinss@(ins:rest) inp = case ins of
(ISet value offset) -> do
MV.write tape (memp + offset) value
interInss (count + 1) tape memp rest inp
- (IMove from tos) -> do
+ (ICopy from to mult) -> do
value <- MV.read tape (memp + from)
- MV.write tape (memp + from) 0
- mapM_ (\(offset, multiplier) -> MV.modify tape ((+) (multiplier * value)) (memp + offset)) tos
+ MV.modify tape ((+) (mult * value)) (memp + to)
interInss (count + 1) tape memp rest inp
(ISlide offset) -> do
interInss (count + 1) tape (memp + offset) rest inp