continue my_set.add(i_2) for i_3 in range(0, 5): if i_3 in my_set: continue my_set.add(i_3) for i_4 in range(0, 5): if i_4 in my_set: continue result = puzzle.execute_program(program, [ i_4, puzzle.execute_program(program, [ i_3, puzzle.execute_program(program, [ i_2, puzzle.execute_program(program, [ i_1, puzzle.execute_program(program, [i_0, 0]) ]) ]) ]) ]) if result > previous_result: previous_result = result my_result = [i_0, i_1, i_2, i_3, i_4] my_set.remove(i_3) my_set.remove(i_2) my_set.remove(i_1) print(previous_result) print(my_result)
def test_less_than(): assert 1 == puzzle.execute_program([7, 2, 0, 0, 99]) assert 0 == puzzle.execute_program([7, 0, 1, 0, 99]) assert 1 == puzzle.execute_program([1107, 0, 3, 0, 99]) assert 0 == puzzle.execute_program([1107, 3, 3, 0, 99])
def test_equals(): assert 1 == puzzle.execute_program([8, 2, 2, 0, 99]) assert 0 == puzzle.execute_program([8, 2, 3, 0, 99]) assert 1 == puzzle.execute_program([1108, 100, 100, 0, 99]) assert 0 == puzzle.execute_program([1108, 101, 100, 0, 99])
def test_jump_if_false(): assert 6 == puzzle.execute_program([6, 3, 4, 0, 99])
def test_jump_if_true(): assert 5 == puzzle.execute_program([5, 1, 3, 4, 99])
def test_multiplication(): assert 198 == puzzle.execute_program([2, 0, 4, 0, 99]) assert 46 == puzzle.execute_program([1102, 23, 2, 0, 99])
def test_addition(): assert 100 == puzzle.execute_program([1, 0, 4, 0, 99]) assert 40 == puzzle.execute_program([1101, 23, 17, 0, 99])
def test_execute_program(): assert 99 == puzzle.execute_program([99])