aoc2023/d05/run1_print.py

34 lines
784 B
Python

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(" ")]
print(r)
print(source)
print(destin)
for n in range(0, r[2]):
destin[r[1] + n] = source[r[0] + n]
print(source)
print(destin)
print("")
print("")
else:
for i in planted:
print(destin[i])
source = list(destin)
destin = list(range(0, lmap))
print(d)
print(destin)
for i in planted:
print(destin[i])
print(min(s) for s in destin)