2025 - Day 7 part 1
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
4f287fdb14
commit
4174f627fc
3 changed files with 193 additions and 0 deletions
35
2025/7/7.py
Normal file
35
2025/7/7.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#!/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=}')
|
||||
142
2025/7/input.txt
Normal file
142
2025/7/input.txt
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
......................................................................S......................................................................
|
||||
.............................................................................................................................................
|
||||
......................................................................^......................................................................
|
||||
.............................................................................................................................................
|
||||
.....................................................................^.^.....................................................................
|
||||
.............................................................................................................................................
|
||||
....................................................................^...^....................................................................
|
||||
.............................................................................................................................................
|
||||
...................................................................^.^.^.^...................................................................
|
||||
.............................................................................................................................................
|
||||
..................................................................^.^.....^..................................................................
|
||||
.............................................................................................................................................
|
||||
.................................................................^.^.^.^.^.^.................................................................
|
||||
.............................................................................................................................................
|
||||
................................................................^.^.......^.^................................................................
|
||||
.............................................................................................................................................
|
||||
...............................................................^.^.^...^.^.^.^...............................................................
|
||||
.............................................................................................................................................
|
||||
..............................................................^.^.^.^.^.^.^...^..............................................................
|
||||
.............................................................................................................................................
|
||||
.............................................................^.^.^...^.......^.^.............................................................
|
||||
.............................................................................................................................................
|
||||
............................................................^.^.....^.^.^.^.^.^.^............................................................
|
||||
.............................................................................................................................................
|
||||
...........................................................^.^...^.^...^.^...^...^...........................................................
|
||||
.............................................................................................................................................
|
||||
..........................................................^.^...^...^...^.^...^.^.^..........................................................
|
||||
.............................................................................................................................................
|
||||
.........................................................^.^.^.^.^.^.....^.^.^...^.^.........................................................
|
||||
.............................................................................................................................................
|
||||
........................................................^.^...^...^.^...^.^.^.^...^.^........................................................
|
||||
.............................................................................................................................................
|
||||
.......................................................^.^.^...^.^...^.^...^.^.^.....^.......................................................
|
||||
.............................................................................................................................................
|
||||
......................................................^.^...^...^.^.^.^.^.^...^.^.^...^......................................................
|
||||
.............................................................................................................................................
|
||||
.....................................................^.^.^.^.^.^...^.^.^...^.........^.^.....................................................
|
||||
.............................................................................................................................................
|
||||
....................................................^...^...^.....^.....^.^.^.^.....^.^.^....................................................
|
||||
.............................................................................................................................................
|
||||
...................................................^...^.^.^.......^...^.....^.^.^...^.^.^...................................................
|
||||
.............................................................................................................................................
|
||||
..................................................^.....^.^.^.^.^.^.^.^.^...^...^.^.^.^...^..................................................
|
||||
.............................................................................................................................................
|
||||
.................................................^.^.^...^.^.^.....^.^.^.^.....^...^.^.^.^.^.................................................
|
||||
.............................................................................................................................................
|
||||
................................................^.^.....^.^...^.^.^...^.....^.^.^.^.^.^...^.^................................................
|
||||
.............................................................................................................................................
|
||||
...............................................^.^.^.^.^.^.^...^.^...^.^...^.^...^.^.^.^.^.^.^...............................................
|
||||
.............................................................................................................................................
|
||||
..............................................^.^.^.^.^.^...^...^...^...^.^.....^.^.^.^.^...^.^..............................................
|
||||
.............................................................................................................................................
|
||||
.............................................^...^.^...^.^.^.......^.^...^.^.^.^.^.^...^.^.....^.............................................
|
||||
.............................................................................................................................................
|
||||
............................................^...^.^...^.^.^.....^.....^.^.^.^.^.....^.^.....^...^............................................
|
||||
.............................................................................................................................................
|
||||
...........................................^.^.^.^.^.^.^.^.^.....^.^.^.^.^...^...^.^.^...^.....^.^...........................................
|
||||
.............................................................................................................................................
|
||||
..........................................^.^...^.^.^.^.^.^.^...^...^.^.^...^.^.^.^.^.^...^...^.^.^..........................................
|
||||
.............................................................................................................................................
|
||||
.........................................^.^...^...^.......^.^.^.^.^.....^.^.^...^.^.^.^.^.^...^.^.^.........................................
|
||||
.............................................................................................................................................
|
||||
........................................^.....^.^.....^.^...^.^...^.^.^.^...........^...^.^...^...^.^........................................
|
||||
.............................................................................................................................................
|
||||
.......................................^.^.^...^.^.^.^.^.^...^.^...^.^.........^.^.^.^.^.^.^.....^.^.^.......................................
|
||||
.............................................................................................................................................
|
||||
......................................^.....^.^...........^.^.^.^.......^...^.^.^...^.......^.......^.^......................................
|
||||
.............................................................................................................................................
|
||||
.....................................^.^.^.....^.^.^.^.^.....^...^.^.^.^.^...^.^...^.^...^...^...^...^.^.....................................
|
||||
.............................................................................................................................................
|
||||
....................................^.^.....^...^.^...^.^.....^.^.^.^.^...^.^...^.^...^.^.^.^...^...^...^....................................
|
||||
.............................................................................................................................................
|
||||
...................................^...^.^.^.^...^.^...^...^.......^.^.^.^.....^.^.^...^.^...^.^...^.^...^...................................
|
||||
.............................................................................................................................................
|
||||
..................................^...^.......^.^.^.^.^.......^.^.^.............^...^.....^...^.^...^.^.^.^..................................
|
||||
.............................................................................................................................................
|
||||
.................................^.^.^.^.......^.....^.^.^...^.....^.....^.^.^.^...^.^...^.^.^...^.......^.^.................................
|
||||
.............................................................................................................................................
|
||||
................................^...^.^.^...^.......^...^.^...^...^.^.^.^.^.^.^.....^.^...^.^...^.^...^.^...^................................
|
||||
.............................................................................................................................................
|
||||
...............................^...^.....^.^.^...^...........^.^...^.........^.^.^.^.^...^.^.^.^.^...^.^.^.^.^...............................
|
||||
.............................................................................................................................................
|
||||
..............................^.^...^.^.......^.....^.^.^.^...^.^.^...^.^...^.^.^...^.^.^.....^...^.^.^...^...^..............................
|
||||
.............................................................................................................................................
|
||||
.............................^.^.^...^.^.^...^.^.^.^.^.^.....^...^.^.^...^.....^.^.^.^.^...^...^.^.^.^.^.^.....^.............................
|
||||
.............................................................................................................................................
|
||||
............................^.^.^...^.^.^...^.^.....^.^...^.^.^.^...^...^...^.^.^.^.^.^...^.......^.^.^.^.^.^.^.^............................
|
||||
.............................................................................................................................................
|
||||
...........................^.^.^.^.^...^...^.^.^.^...^.^.........^.^.^...^.....^.^.^.^...^.^...^.^.....^...^.^.^.^...........................
|
||||
.............................................................................................................................................
|
||||
..........................^...^...^.^.^.^.^.^.^.^.^.^.^...^...^...^.^.^.^.^...^.......^.^...^.^.^.^.^.....^.^...^.^..........................
|
||||
.............................................................................................................................................
|
||||
.........................^.^...^.^.^.^.^.^...^...^...^.....^...^.^.^.^...^.....^.^...^.^...^...^...^.^.^.^.^...^...^.........................
|
||||
.............................................................................................................................................
|
||||
........................^.^...^...^.^...^.^.^.^.^...^.......^...^.^.....^.^.^.....^...^.^.^.^.^.^.^...^.^...^...^.^.^........................
|
||||
.............................................................................................................................................
|
||||
.......................^.^.^.^.^.^.^...^.......^...^.^.^.^.^.^...^.^.^...........^.^.^.^...^.^.....^.^.^.^...^.^.^...^.......................
|
||||
.............................................................................................................................................
|
||||
......................^.^.....^.^...^.^.....^.^.^...^.^.^.^.^.^...^.^.....^.....^...^.^.^.^.^.^.......^.^.^.^...^.^.^.^......................
|
||||
.............................................................................................................................................
|
||||
.....................^.^.^...^.^.^.....^.^.^.^...^...^.^.^.^.^.^.^.^.^.^.^...^.^.........^.^.^.^.^.^.^...^.....^...^...^.....................
|
||||
.............................................................................................................................................
|
||||
....................^.......^...^.^.^.^.............^.^.^.^.^...^.^.^.^.^.^.^.^.^.^...^.^.^.^.^.......^...^.^.^.^.^.^.^.^....................
|
||||
.............................................................................................................................................
|
||||
...................^.^.^.^.^.............^.^.^.^.^.^.^.^...^.^.^.^...^.^.^.........^.^...^...^.^.^...^.^.^.^...^.^.^...^.^...................
|
||||
.............................................................................................................................................
|
||||
..................^...^.^.^...^.^.^...^.^.^.....^.^.^.^.^.^.^.^...^...........^.^.^...^.....^...^.^.^.......^.^.....^.^.^.^..................
|
||||
.............................................................................................................................................
|
||||
.................^...^.^...^.....^.^.^...^.^.^.^...^.^.^...^...^.^.^.^.^.^.^.....^.^.^.....^...^...^.^.^...^.^...^.^...^...^.................
|
||||
.............................................................................................................................................
|
||||
................^.^.^.^.^.^.^.^...^.......^.^.^.....^.^.^...^.....^.^...^.^.^.......^.^.^.^...^.....^.^...^.^.^.^.......^...^................
|
||||
.............................................................................................................................................
|
||||
...............^.^.^.^...^...^.^.^.....^.^.^.^...^.^.^.^.^.^...^.^.^.^...^.^...^.^.^.......^.^.^.^...^.^.^.^.^.^...^.^.^...^.^...............
|
||||
.............................................................................................................................................
|
||||
..............^.^...^...^...^...^.^.^.^.^.......^.^.^.^.^...^.....^.^.^.^.......^.^.^.^.^.^.^.^.^...^...^.^.^.^.^.^...^.^...^.^..............
|
||||
.............................................................................................................................................
|
||||
.............^.^...^.^.^...^...^.......^.....^.^...^.......^.^.^.^...^.^.^.^...^.^.^.......^.^.......^.^...^.^.^.^.^.^.^.^.^.^.^.............
|
||||
.............................................................................................................................................
|
||||
............^.^...^.^.....^.^.^...^.^...^.^.^.......^.^.^.^.^.^.....^...^.....^.^.^...^.^...^...^.^.^.^.......^.......^.^.^.^.^.^............
|
||||
.............................................................................................................................................
|
||||
...........^.......^...^...^.....^.^...^.^...^...........^.^.^.^...^.......^...^.^.^.....^.^.....^.....^.^...^.^.^.^.^.^.^.....^.^...........
|
||||
.............................................................................................................................................
|
||||
..........^.....^.^.....^.^.^.^.^...^.^...^.^.^.^.^.^.^.^...^.^...^...^.^.^.^.^...^.^.....^.^...^...^...^.....^.^.^.^.^.^.^.^.^.^.^..........
|
||||
.............................................................................................................................................
|
||||
.........^.^.^.^.^...^.^...^.^.^...^.^.^...^.^.^.^.^.^.^.^...^.^.^.^.^...^.^.^...^.^...^.^.^.^.^...^...^.^.^.^.....^...^.....^.^.^.^.........
|
||||
.............................................................................................................................................
|
||||
........^.^.^...^.^.^.^.^.^.^.^.^.^.....^.....^.^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.....^.^.....^.^.....^.....^...^...^.....^...^.......^........
|
||||
.............................................................................................................................................
|
||||
.......^.^.^.^.^.^.....^.^.^.^.^.^.^...^.^...^.....^.^...^.^.^.^.^...^...^.^.^.^.^.^.....^.^...^.....^.^.^.^.^.^.^.^.^...^.^.^...^...^.......
|
||||
.............................................................................................................................................
|
||||
......^.^...^.^...^.^.^.^...^...^...^.^...^.......^.^...^.^.^.....^.^.^.^.^.^...^.^...^...^.^...^.^.^.^.^.^.^.^.......^.^.^...^...^...^......
|
||||
.............................................................................................................................................
|
||||
.....^.^.^.^.^.^.^.....^.....^.^...^...^.^.^...^...^.^...^.^.^.^...^.^.^.^.^.^.^.....^.^.^...^.^.^.^.......^...^.^.......^.^.^.........^.....
|
||||
.............................................................................................................................................
|
||||
....^...^.^.^.^...^.....^...^...^.^.^.^.^.^.^.......^.^.^.^.^.^...^.^.....^.^...^.^.......^.^...^...^.^.^.^...^.^.^.^.......^.^.^.^...^.^....
|
||||
.............................................................................................................................................
|
||||
...^.^...^...^.^.^...^.^.^.^.^.^.^.^.^.^.^.^.^.....^.^.^.^.^.^...^...^.^...^.....^.^.....^.^.^...^.^.^.^.^...........^...^...^.^.^.....^.^...
|
||||
.............................................................................................................................................
|
||||
..^...........^.^.^.^.^.^.....^...^.^.^.^.^...^.^...^.^.^.^.^.^...^.^...^.^.^...^...^...^.^.^.^.^.^.^...^.^.....^.^.^.^.^.^.^.^.^.^.^.^.^.^..
|
||||
.............................................................................................................................................
|
||||
.^...^...^.^.........^...^.^.^.....^...^...^.^.^.^.^...^.^.^.^.^...^.........^.^...^.^.^...^.^.^.^.^...^.^.^.^.^.^.^.....^.....^.....^.^.^.^.
|
||||
.............................................................................................................................................
|
||||
16
2025/7/input_example.txt
Normal file
16
2025/7/input_example.txt
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
.......S.......
|
||||
...............
|
||||
.......^.......
|
||||
...............
|
||||
......^.^......
|
||||
...............
|
||||
.....^.^.^.....
|
||||
...............
|
||||
....^.^...^....
|
||||
...............
|
||||
...^.^...^.^...
|
||||
...............
|
||||
..^...^.....^..
|
||||
...............
|
||||
.^.^.^.^.^...^.
|
||||
...............
|
||||
Loading…
Reference in a new issue