Exemplo n.º 1
0
def part1():
    target = 19690720
    part1_code = _code.copy()
    cpu = Cpu(_code)
    for noun in range(100):
        for verb in range(100):
            part1_code[1] = noun
            part1_code[2] = verb
            cpu.flash(part1_code)
            memory = cpu.run()
            if memory[0] == target:
                return 100 * noun + verb