From aa5ae674ec83224d32f983ec6a5d383ce58e06ae Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Tue, 8 Dec 2020 09:04:38 +0100 Subject: [PATCH] only int-cast param when needed --- day08.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/day08.py b/day08.py index 611c4f0..c1a1fca 100644 --- a/day08.py +++ b/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