def p1(inp, debug=False): m = 0 for setting in permutations([0, 1, 2, 3, 4]): setting = [[s] for s in setting] setting[0] = setting[0] + [0] out = IntComputer.pipe(list(zip([inp] * 5, setting)), name="Amplifier", debug=debug) if out[0] > m: m = out[0] return m
def p2(inp, debug=False): m = 0 for setting in permutations([5, 6, 7, 8, 9]): setting = [[s] for s in setting] setting[0] = setting[0] + [0] out = IntComputer.pipe(list(zip([inp] * 5, setting)), loop=True, name="Amplifier", debug=debug) if out[0] > m: m = out[0] return m