solved day 7 part 1!

brechtje
Brechtje van Gessel 2025-12-11 21:12:46 +01:00
parent d2ea29cb62
commit 9df93db0a6
1 changed files with 22 additions and 0 deletions

22
brechtje/7/7-1.py Normal file
View File

@ -0,0 +1,22 @@
raw_input = open("input.txt", "r").read().splitlines()
input = []
for line in raw_input:
input.append(list(line))
input[1][input[0].index('S')] = '|'
answer = 0
for y, line in enumerate(input):
for x, char in enumerate(line):
if y != len(input) - 1:
if char == '|' and input[y + 1][x] != '^':
input[y + 1][x] = '|'
elif char == '|' and input[y + 1][x] == '^':
answer += 1
input[y + 1][x - 1] = '|'
input[y + 1][x + 1] = '|'
print(''.join(line))
print(answer)