only int-cast param when needed
This commit is contained in:
parent
9b0b8eb1f6
commit
aa5ae674ec
6
day08.py
6
day08.py
@ -19,15 +19,13 @@ def runCode(lines, infinite_returns_value=False):
|
||||
|
||||
lines_executed.add(line_pointer)
|
||||
command, param = lines[line_pointer].split()
|
||||
param = int(param)
|
||||
if command == 'nop':
|
||||
pass
|
||||
line_pointer += 1
|
||||
elif command == 'acc':
|
||||
accumulator = accumulator + param
|
||||
accumulator = accumulator + int(param)
|
||||
line_pointer += 1
|
||||
elif command == 'jmp':
|
||||
line_pointer = line_pointer + param
|
||||
line_pointer = line_pointer + int(param)
|
||||
|
||||
return accumulator
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user