Some checks reported errors
continuous-integration/drone/push Build encountered an error
35 lines
No EOL
788 B
Python
35 lines
No EOL
788 B
Python
#!/usr/bin/env python
|
|
# 2025 - Advent Of Code 7
|
|
|
|
# file = 'input_example.txt'
|
|
file = 'input.txt'
|
|
|
|
# pylint: disable=consider-using-with
|
|
grid = [line.strip('\n') for line in open(file, encoding="utf-8")]
|
|
|
|
MAX_X = len(grid[0])
|
|
MAX_Y = len(grid)
|
|
|
|
for s in range(0, len(grid[0])):
|
|
if grid[0][s] == 'S':
|
|
start_pos = (s, 0)
|
|
break
|
|
print(f'{start_pos=}')
|
|
|
|
beams = [start_pos]
|
|
split = 0
|
|
for liney in range(1, MAX_Y-1):
|
|
new_beams = []
|
|
for b in beams:
|
|
x = b[0]
|
|
y = b[1]
|
|
if grid[y+1][x] == '^':
|
|
new_beams.append((x-1, y+1))
|
|
new_beams.append((x+1, y + 1))
|
|
split += 1
|
|
else:
|
|
new_beams.append((x, y + 1))
|
|
print(f'end {liney}: {new_beams}')
|
|
beams = list(set(new_beams))
|
|
|
|
print(f'{split=}') |