18 lines
651 B
Python
18 lines
651 B
Python
with open(r'day7/input.txt', 'r') as input:
|
|
lines = input.read().split('\n')[:-1]
|
|
|
|
active = {lines[0].index('S'):1}
|
|
|
|
for line in lines[1:]:
|
|
active_buf = {}
|
|
for i in active:
|
|
if line[i] == '^':
|
|
if i > 0:
|
|
active_buf[i-1] = active[i] if i-1 not in active_buf.keys() else active_buf[i-1] + active[i]
|
|
if i < len(line) -1:
|
|
active_buf[i+1] = active[i] if i+1 not in active_buf.keys() else active_buf[i+1] + active[i]
|
|
else:
|
|
active_buf[i] = active[i] if i not in active_buf.keys() else active_buf[i] + active[i]
|
|
active = active_buf
|
|
|
|
print(sum(active.values()))
|