11-1 fertig

This commit is contained in:
2023-12-11 16:03:39 +01:00
parent 2f3dd824d0
commit 25175daff9
8 changed files with 350 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ part_sum = 0
matrix = []
# read matrix like day 3
input_file = open("input", "r")
input_file = open("input-ex41", "r")
for line in input_file:
matrix.append(line.strip())
input_file.close()
@@ -71,12 +71,13 @@ def where_to_go(z, s, pre):
previous = (start[0], start[1])
aktuell = [start[0]-1, start[1]]
aktuell = [start[0], start[1]+1]
count = 1
while True:
new = where_to_go(aktuell[0], aktuell[1], previous)
print(aktuell, previous, new)
matrix[aktuell[0]] = matrix[aktuell[0]][:aktuell[1]] + "X" + matrix[aktuell[0]][aktuell[1]+1:]
if new == "Ende":
break
else:
@@ -87,3 +88,6 @@ while True:
print("Counter:", count)
print("HalfCounter:", count/2)
for i in matrix:
print(i)