From bf16b19b1f6deffd1983efca059db576f3b60ee5 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 13 Dec 2021 10:40:39 +0300 Subject: 2019, tracking --- 2019/day7/comm.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 2019/day7/comm.py (limited to '2019/day7/comm.py') diff --git a/2019/day7/comm.py b/2019/day7/comm.py new file mode 100644 index 0000000..458d8b1 --- /dev/null +++ b/2019/day7/comm.py @@ -0,0 +1,19 @@ +from itertools import permutations +import os +import subprocess + +perm = permutations(range(5)) +res = [] + +for seq in perm: + signal = 0 + for phase in seq: + out = subprocess.run( + ["perl", "intcode.pl", "part1.in"], + capture_output=True, + input=b"%d\n%d" % (phase, signal), + ) + signal = int(out.stdout) + res.append(signal) + +print(sorted(res)[-1]) -- cgit v1.2.3-70-g09d2