only check for 'nop' if the check for 'jmp' failes. Saves 0.5ms :)

This commit is contained in:
Stefan Harmuth 2020-12-08 09:12:24 +01:00
parent b4ff7c58d0
commit 761e3bf975

View File

@ -42,11 +42,10 @@ def part2(test_mode=False):
continue
check_code = my_input[:]
if check_command.startswith('nop'):
check_code[counter] = check_code[counter].replace('nop', 'jmp')
if check_command.startswith('jmp'):
check_code[counter] = check_code[counter].replace('jmp', 'nop')
elif check_command.startswith('nop'):
check_code[counter] = check_code[counter].replace('nop', 'jmp')
check_answer = runCode(check_code)
if check_answer is not None: