From 6d3b07cdf6cd46261a2e3524b39a809602c9b157 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 8 Dec 2021 15:15:05 +0100 Subject: Do not hardcode the goal --- 2020/09/puzzle-2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '2020') diff --git a/2020/09/puzzle-2.py b/2020/09/puzzle-2.py index c890fb3..b560a29 100755 --- a/2020/09/puzzle-2.py +++ b/2020/09/puzzle-2.py @@ -1,10 +1,12 @@ #!/usr/bin/env python3 +import subprocess + import numpy as np def main() -> None: - goal = 138879426 + goal = int(subprocess.run(["./puzzle-1.py"], capture_output=True, text=True).stdout) with open("input", "r", encoding="utf-8") as f: nums = np.array(list(map(int, f.readlines())), dtype=int) -- cgit v1.2.3