aoc2023/d14/part1.py

31 lines
658 B
Python
Raw Normal View History

2023-12-15 22:58:40 +00:00
import sys
# load ptf flat
G = [list(l) for l in sys.stdin.read().splitlines()]
W = len(G[0])
H = len(G)
print(W,H)
# move far north each com
for x in range(W):
for y in range(H):
print(f'{x=},{y=} = {G[y][x]}')
if G[y][x] == "O":
for j in range(y-1,0-1,-1):
print(f'{j=}')
if G[j][x] == '.': # can go north
print(f'north, {j=}')
G[j][x] = "O"
G[j+1][x] = "."
else:
break
S = 0
for y,row in enumerate(G):
print(''.join(row))
S += (H-y)*row.count('O')
print(S)
# compute