Ejemplo n.º 1
0
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)