def main(): program = Intcode() program.load_from_file('inputs/day_02_input.txt') program.dsky(12, 2) program.execute() print("\nFinal value at position 0: {0}\n".format(program.memory[0])) return program.memory[0]
def main(): output = 19690720 program = Intcode() program.load_from_file('inputs/day_02_input.txt') for noun, verb in \ [(noun, verb) for noun in range(0, 100) for verb in range(0, 100)]: program.rewind() program.dsky(noun, verb) program.execute() if program.memory[0] == output: break program_code = 100 * noun + verb print("\nThe program outputting {0} is: {1:04d} " "(noun {2:02d} - verb {3:02d})\n".format(program.memory[0], program_code, noun, verb)) return program_code