Fix day 5...
This commit is contained in:
parent
f038b5e8d4
commit
67629545f9
|
@ -77,13 +77,15 @@ def run_intcode(codes, input_value):
|
||||||
print("LT:", codes[ip : ip + 4])
|
print("LT:", codes[ip : ip + 4])
|
||||||
operand1 = read_param(codes, ip + 1, mode1)
|
operand1 = read_param(codes, ip + 1, mode1)
|
||||||
operand2 = read_param(codes, ip + 2, mode2)
|
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
|
ip += 4
|
||||||
elif code == Opcode.EQ:
|
elif code == Opcode.EQ:
|
||||||
print("EQ:", codes[ip : ip + 4])
|
print("EQ:", codes[ip : ip + 4])
|
||||||
operand1 = read_param(codes, ip + 1, mode1)
|
operand1 = read_param(codes, ip + 1, mode1)
|
||||||
operand2 = read_param(codes, ip + 2, mode2)
|
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
|
ip += 4
|
||||||
elif code == Opcode.HALT:
|
elif code == Opcode.HALT:
|
||||||
print("HALT.")
|
print("HALT.")
|
||||||
|
|
Loading…
Reference in a new issue