def test_ThirdExample(self):
     path = 'ExampleData\Day7Example3'
     testBank = FindMaxThrusterSignalFromPath(path)
     self.assertEqual(65210,testBank.highestThrusterSignal)
 def test_FirstExample(self):
     path = 'ExampleData\Day7Example1'
     testBank = FindMaxThrusterSignalFromPath(path)
     self.assertEqual(43210,testBank.highestThrusterSignal)
 def test_SecondExample(self):
     path = 'ExampleData\Day7Example2'
     testBank = FindMaxThrusterSignalFromPath(path)
     self.assertEqual(54321,testBank.highestThrusterSignal)
Exemple #4
0
day5computer.inputs.append(1)
with patch('builtins.print') as p:
    day5computer.run()
print(
    f'Day 5, part 1: After running the program, the last output is is: {day5computer.outputs[-1]} (12428642)'
)
day5part2computer = constructComputerFromFile(pathInput5)
day5part2computer.inputs.append(5)
with patch('builtins.print') as p:
    day5part2computer.run()
print(
    f'Day 5, part 2: The diagnostic code for system ID 5 is: {day5part2computer.outputs[-1]} (918655)'
)

pathInput7 = 'Inputs/inputDay7'
testBank = FindMaxThrusterSignalFromPath(pathInput7)
resultBank = testBank.highestThrusterSignal
print(f'Day 7, part 1: The highest thruster output is: {resultBank} (17790)')
testBankFeedbackLoop = FindMaxThrusterFeedbackLoopSignalFromPath(pathInput7)
resultFeedbackLoop = testBankFeedbackLoop.highestThrusterSignal
print(
    f'Day 7, part 2: The highest thruster output with feedback is: {resultFeedbackLoop} (19384820)'
)

pathInput9 = 'Inputs/inputDay9'
day9computer = constructComputerFromFile(pathInput9)
day9computer.inputs.append(1)
with patch('builtins.print') as p:
    day9computer.run()
print(
    f'Day 9, part 1: The BOOST keycode is: {day9computer.outputs[0]} (3380552333)'