def part_one(): # Setup program = Program(1024 * 1024) program.load_code("testInput.txt") # Run #program.load_input([1]) program.run() print(program.is_done()) output = program.get_output() print(output)
def part_one(): # Setup program program = Program() program.load_code("thrusterProgram.txt") # Try all phase setting permutations phase_configuration_permutations = itertools.permutations([0, 1, 2, 3, 4]) max_output = 0 for phase_configuration in phase_configuration_permutations: output = 0 for phase in phase_configuration: program.load_input([output, phase]) program.reset() program.run() output = program.get_output() if output > max_output: max_output = output print("Highest signal to thrusters is: %d" % max_output)
def part_one_and_two(): program = Program() program.load_code("input.txt") program.run()