From d6da080a43c45889612e230781ba3382d0bed41f Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 5 Dec 2023 10:46:47 +0100 Subject: [PATCH] d05 part one - not done --- d05/run1.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 d05/run1.py diff --git a/d05/run1.py b/d05/run1.py new file mode 100644 index 0000000..6c42388 --- /dev/null +++ b/d05/run1.py @@ -0,0 +1,21 @@ +import sys + +lmap=100 + +alma = [ele for ele in sys.stdin.read().splitlines() if ele != ""] +planted = [int(ele) for ele in alma[0].replace("seeds: ", "").split(" ")] + +source = list(range(0, lmap)) +destin = list(range(0, lmap)) + +for d in alma: + if "map" not in d and "seeds:" not in d: + r = [int(i) for i in d.split(" ")] + for n in range(0, r[2]): + destin[r[1] + n] = source[r[0] + n] + else: + source = list(destin) + destin = list(range(0, lmap)) + +for i in planted: + print(destin[i]) \ No newline at end of file