only check for 'nop' if the check for 'jmp' failes. Saves 0.5ms :)
This commit is contained in:
parent
b4ff7c58d0
commit
761e3bf975
5
day08.py
5
day08.py
@ -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:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user