From 67629545f9d9c34607272698ffff79adfdb4b554 Mon Sep 17 00:00:00 2001 From: Dece Date: Sat, 7 Dec 2019 01:21:40 +0100 Subject: [PATCH] Fix day 5... --- 2019/day5.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/2019/day5.py b/2019/day5.py index 9cb8837..47e4c8d 100644 --- a/2019/day5.py +++ b/2019/day5.py @@ -77,13 +77,15 @@ def run_intcode(codes, input_value): print("LT:", codes[ip : ip + 4]) operand1 = read_param(codes, ip + 1, mode1) operand2 = read_param(codes, ip + 2, mode2) - codes[ip + 3] = int(operand1 < operand2) + output_pos = codes[ip + 3] + codes[output_pos] = int(operand1 < operand2) ip += 4 elif code == Opcode.EQ: print("EQ:", codes[ip : ip + 4]) operand1 = read_param(codes, ip + 1, mode1) operand2 = read_param(codes, ip + 2, mode2) - codes[ip + 3] = int(operand1 == operand2) + output_pos = codes[ip + 3] + codes[output_pos] = int(operand1 == operand2) ip += 4 elif code == Opcode.HALT: print("HALT.")