From b0449d8f9ec0c6cc89029c659106162f6b0d24f7 Mon Sep 17 00:00:00 2001 From: Thom Dickson Date: Sun, 5 Dec 2021 02:02:18 -0500 Subject: [PATCH] Start boilerplate for day05 --- day05/day05.in | 10 ++++++++++ day05/day05.py | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 day05/day05.in create mode 100644 day05/day05.py diff --git a/day05/day05.in b/day05/day05.in new file mode 100644 index 0000000..b258f68 --- /dev/null +++ b/day05/day05.in @@ -0,0 +1,10 @@ +0,9 -> 5,9 +8,0 -> 0,8 +9,4 -> 3,4 +2,2 -> 2,1 +7,0 -> 7,4 +6,4 -> 2,0 +0,9 -> 2,9 +3,4 -> 1,4 +0,0 -> 8,8 +5,5 -> 8,2 diff --git a/day05/day05.py b/day05/day05.py new file mode 100644 index 0000000..4cfb260 --- /dev/null +++ b/day05/day05.py @@ -0,0 +1,23 @@ +def ingest(input): + paths = [] + for line in input: + print(line) + paths.append([[int(x) for x in point.split(",")] for point in + line.split(" -> ")]) + return paths + + +def part1(): + with open("day05.in", "r") as f: + paths = ingest([line.rstrip() for line in f]) + print([[x[0][0], x[1][0]] for x in paths]) + print(paths) + + +def main(): + print("=== PART 1 ===") + part1() + + +if __name__ == "__main__": + main()