diff --git a/brechtje/7/7-1.py b/brechtje/7/7-1.py new file mode 100644 index 0000000..55d7918 --- /dev/null +++ b/brechtje/7/7-1.py @@ -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) \ No newline at end of file