Work on day05 part1

This commit is contained in:
Thom Dickson 2021-12-06 14:22:55 -05:00
parent b0449d8f9e
commit e71d214316
Signed by: boots
GPG Key ID: 40BE2AF8EBF8D2BB
1 changed files with 13 additions and 2 deletions

View File

@ -1,4 +1,6 @@
def ingest(input):
"""Parse the input data and load it into a working datastructure to solve
the problem"""
paths = []
for line in input:
print(line)
@ -7,11 +9,20 @@ def ingest(input):
return paths
def build_chart(paths):
"""Create an empty table using the largest x and y values"""
size_x = max([x[0][0] for x in paths] + [x[1][0] for x in paths])
size_y = max([y[0][1] for y in paths] + [y[1][1] for y in paths])
chart = [[0 for x in range(size_x)] for y in range(size_y)]
return chart
def part1():
"""Solution for part one of day05"""
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)
chart = build_chart(paths)
[print(line) for line in chart]
def main():