Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from ampIntcode import intcode
- from itertools import permutations
- #get a two-dimentional array of all permutations of the numbers 1 through 4
- perms = list(permutations(range(0,5)))
- for i in range(len(perms)):
- perms[i] = list(perms[i])
- highOutput = 0
- highArray = []
- file1 = "input.txt"
- for x in perms:
- output = intcode(file1,x[4],intcode(file1,x[3],intcode(file1,x[2],intcode(file1,x[1],intcode(file1,x[0],0)))))
- if(output>highOutput):
- highOutput = output
- highArray = x
- print("The highest output permutation was " + str(highArray))
- print("with an output of " + str(highOutput))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement