Working on it.
This commit is contained in:
parent
802af0fd8b
commit
54c65907fb
3 changed files with 252 additions and 0 deletions
45
04/README.md
Normal file
45
04/README.md
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
# --- Day 4: Printing Department ---
|
||||||
|
|
||||||
|
You ride the escalator down to the printing department. They're clearly getting ready for Christmas; they have lots of large rolls of paper everywhere, and there's even a massive printer in the corner (to handle the really big print jobs).
|
||||||
|
|
||||||
|
Decorating here will be easy: they can make their own decorations. What you really need is a way to get further into the North Pole base while the elevators are offline.
|
||||||
|
|
||||||
|
"Actually, maybe we can help with that," one of the Elves replies when you ask for help. "We're pretty sure there's a cafeteria on the other side of the back wall. If we could break through the wall, you'd be able to keep moving. It's too bad all of our forklifts are so busy moving those big rolls of paper around."
|
||||||
|
|
||||||
|
If you can optimize the work the forklifts are doing, maybe they would have time to spare to break through the wall.
|
||||||
|
|
||||||
|
The rolls of paper (@) are arranged on a large grid; the Elves even have a helpful diagram (your puzzle input) indicating where everything is located.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```txt
|
||||||
|
..@@.@@@@.
|
||||||
|
@@@.@.@.@@
|
||||||
|
@@@@@.@.@@
|
||||||
|
@.@@@@..@.
|
||||||
|
@@.@@@@.@@
|
||||||
|
.@@@@@@@.@
|
||||||
|
.@.@.@.@@@
|
||||||
|
@.@@@.@@@@
|
||||||
|
.@@@@@@@@.
|
||||||
|
@.@.@@@.@.
|
||||||
|
```
|
||||||
|
|
||||||
|
The forklifts can only access a roll of paper if there are fewer than four rolls of paper in the eight adjacent positions. If you can figure out which rolls of paper the forklifts can access, they'll spend less time looking and more time breaking down the wall to the cafeteria.
|
||||||
|
|
||||||
|
In this example, there are 13 rolls of paper that can be accessed by a forklift (marked with x):
|
||||||
|
|
||||||
|
```txt
|
||||||
|
..xx.xx@x.
|
||||||
|
x@@.@.@.@@
|
||||||
|
@@@@@.x.@@
|
||||||
|
@.@@@@..@.
|
||||||
|
x@.@@@@.@x
|
||||||
|
.@@@@@@@.@
|
||||||
|
.@.@.@.@@@
|
||||||
|
x.@@@.@@@@
|
||||||
|
.@@@@@@@@.
|
||||||
|
x.x.@@@.x.
|
||||||
|
```
|
||||||
|
|
||||||
|
Consider your complete diagram of the paper roll locations. How many rolls of paper can be accessed by a forklift?
|
||||||
140
04/input/grid.txt
Normal file
140
04/input/grid.txt
Normal file
|
|
@ -0,0 +1,140 @@
|
||||||
|
@@@@@@@@@.@@@@@@@@@.@.@..@@..@@.@.@@.@@.@@@@@@..@@..@.@.@@..@.@.@@@@@.@@.@@@@@@..@@@@@@@....@@@@@@@@.@.@.@@@@@@@@@@.@..@@@@@@@@@@@@@@@@.@.@@
|
||||||
|
@@@.@@@.@@@@@@..@..@@@@.@.@.@.@@@@.@.@@@@@@@..@@.@@.@.@@@@.@@@@@@.@@@@.@.@@@...@@.@@@@@@.@.@@@.@.@@@@@.@@@@@@@.@@.@@@@@@@@.@..@@@@.@@@@@@.@@
|
||||||
|
@@..@@.@@@.@@@@..@@..@..@@@@@@.@.@@..@@@@....@@@@@@.@.@@.@..@@@@@.@@@@.@@@@@..@@@.@@.@@.@@..@@@@@@@@.@@@@.@@@.@@@@@@@@@@.@@.@@@@.@@@..@@@.@@
|
||||||
|
@...@@.@...@@@@@@.@@..@@@@@@@.@...@@@@.@.@@...@@@.@@@@@@.@@@.@@@.@.@..@@@@@@@@.@.@@@@..@@@.....@.@@@@..@...@.@@@@@..@@@.@@@.@@....@.@@@...@.
|
||||||
|
..@@@@@.@.@@.@@@..@@@@@@.@@@.@@@@.@@@@.@...@@@@@...@.@@@..@..@..@.@.@.@@@@..@....@@@...@@@@@.@@.@@.@..@.@@@..@@@@@@@@..@.@.@@.@@@..@@@..@@@@
|
||||||
|
@@@.@@..@@.@@@..@@.....@@...@@@.@.@@@@@.@@@@..@.@@@@.@.@@@@@@.....@@.@@.@..@@@@@@@..@@.@@..@@@@.@@@.@..@@@.@@@@.@@@.@@@.@@@@@@..@@@@@@.@.@..
|
||||||
|
.@@@@.@.@..@.@@@@...@.@..@.@@@.@..@.@...@@@.@@..@..@...@@@..@@@@.@@@.@@@.@@@@.@.@...@@@@.@..@@@.@@..@.@.@@...@.@@.@.@@.@.@.@@@@.@@..@@@@.@@.
|
||||||
|
.@@@@@@@@@@@...@.@.@@@.@@.@.@.@.@@@@@@@.@@.@@@......@.@@.@@@.@@@@...@@@@@@@@@@@@@@@@.@@@.@@.@..@@.@@@@@..@@@@@@...@@@.@@@.@.@@@@.@@@@@@...@@
|
||||||
|
@..@.@@.@@@..@@@.@@.@@@@@@@@@@@@@@.@....@...@@.@@@..@@@@.@@@@@@@@@.@.@@..@@.@@@.@.@.@@@.@.@@@.@@@......@@@@...@@.@@@@.@.@@@.@.@@..@@@@.@.@@@
|
||||||
|
@@.@..@.@@@@@@@@.@.@@@@@.@.@.@@.@@@.@@@@@@@.@@@@@..@@@@.@@@@@@..@@@@@@..@.@.@@@.@@@@.@.@@.@@@.@@@@.@.@@...@@@@@@@.@@..@@@@.@@@.@@@.@@@@@..@@
|
||||||
|
@..@.@.@..@.@@.@@@.@..@@@@.@.....@..@@@@@..@@@..@@.@@@@@@.@@@....@@..@@@@@@@@@..@@@.@@..@@@.@.@@@@@.@@.@@@..@...@@.@@@..@.@.@.@@...@@.@@@.@.
|
||||||
|
.@@@.@@.@@@..@..@@.@.@@@@@@.@.@.@@@@.@@@@@@@@..@.@@@@@@@@.@@@@@@@@@@.@@.@@@...@@.@@@@@@@.@@@.@..@@.@....@@.@@...@@.@@..@.@..@@@@..@.@@@.@..@
|
||||||
|
.@.@@@.@@.@..@.@.@.@@.@.@@...@.@@.@..@.@..@.@@.@@.@@@@@.@@.@.@.@@@@@@@@@@@.@@@@@.@.@@.@@@.@.@@@@.@@@@.@..@.@@@@@.@@@@@.@.@@@.@@@.@@@@.@@.@@.
|
||||||
|
.@@..@.@@@@.@@@@@.@@@..@@@..@...@@@@@@.@.@.@.@@@@@@@.@@..@@@.....@@.@.@@@..@@@@..@@@..@.@@.@@@@@@.@@@...@...@@@@.@@@@@@@@@..@@@.@.@@.@@@@@..
|
||||||
|
.@..@@.@..@@@@@@@@@@@@.@@@@.@..@.@@@......@@@@@@.@.@..@@.@.@@.@.@...@.@.@@@@@@.@@@.@@@@@@..@.@.@...@..@@.@..@@@...@.@@@..@@...@@@@@@@@@..@..
|
||||||
|
@@.@...@@@@.@..@@.@@@.@@@.@.@.@.@.@.@.@@.@@@.@.@@@@@.@@@..@@..@..@@@@.@.@@@.@@.@.@@@@@@@@@.@.@.@.@@@@.@@@.@@@@.@@@.@..@.@@@@@@@.@@..@@@@..@@
|
||||||
|
@@.@@.@@.@@@@.@@@.@@@.@@@@...@@@@@@@@@.@@@.@@.......@@@..@@.@@@@@@@@...@@.@@@@@@@@@.@@@@@@@@.@.@@@@.@.@@@@@.@@@@@.@.@@@.@@@@@@@@@.@@.@.@@@.@
|
||||||
|
.@.@@@@@@@@@.@@@@..@.@.@.@@@@.@@@@@.@@....@.@.@.@@..@.@@@@@.@@@@@@@@.@.@@...@@@.@@@.@@@...@.@@@@@.@.@.@@@.@@@.@@@...@@.@@@....@.@@@@.@@@....
|
||||||
|
@.@@@.@@.@@@@@@@@@@.@@.@@@@@@@@@@@.@@@@@@@@@@@.@@@.@@.@..@.@@@@.@.@.@@.@..@@@@.@@@@@@@..@@@@@@@@.@.@.@@@@@.@.@@@@@..@..@.@.@@@.@@.@@@@..@@@@
|
||||||
|
.@...@@@@..@@@@...@@@@...@@@@.@...@.@@.@@@@@.@.@@@.@@@@@.@.@@@@@@....@@@@@@....@@@@.@.@@@@@@.@@@@@.@@.@..@.@@@@...@@@@@@.@..@@@@....@.@@.@@@
|
||||||
|
..@.@@@..@@@@.@@@@..@@.@@....@@@@.....@.@.@@@.@.@@@.@@@@@...@@@@@@.@@@@@..@@.@@..@@@.@..@.@....@@@.@.@.@.@@.@@@@@@@.@@@@@@@@.@.@.@@@..@..@.@
|
||||||
|
.@.@@@@@@@@@@@..@.@@@@.@@.@@@@..@...@..@@@.@.@@@@...@.@.@@..@.@@@@@@@@.@@.@.@..@@@.@.@@...@.@@@@..@.@@.....@.@@@@@.......@@@@@..@@@@@@@.@.@@
|
||||||
|
@@.@.@@@@@@@@@@@@.@@.@@@@@@.@@@.@.@.@@@@@@@.....@..@@.@@@@.@.@@@@@@.@@...@@.@@.@@@@.@.@....@...@.@.@@@@@@.....@@..@.@.@@.@@@@...@@@@@.@@@@@@
|
||||||
|
.@@@@..@@@@@@..@.@..@.@@.@...@@@@.@@@.@@.@@....@.@@@...@.@@....@.@@.@@@..@@@@.@@@@.@..@.@.@@@@.@@@@....@@.@@..@@@@@@.@@.@@.@..@@.@.@@@....@@
|
||||||
|
.@@.@@.@@@@@@@.@@@@@@.@@.@.@@@.@@..@.@@.@.@@@@@@.@@@.@@@@@@@@.@....@@@@@@..@...@.@.@@@@@@@.@.@@@@.@.@@@@.@@@....@@@@@@.@@@@@@@@@.@@@.@@@@@@.
|
||||||
|
@...@@@@@@.@@@.@..@@@.@.@@.@@.@@@@.@@@...@.@@@@@@@@@@@..@@@..@@..@@.@.@@.@@@@@@@.@@@@@.@@.@..@@.@@...@@@..@@@@....@@.@@@@@@@@@....@.@.@.@@.@
|
||||||
|
.@.@.@@@@@@@.@@.@.@@.@.@@@@.@@@..@@@@@@.@@@.@@.@@@@@.@..@@@@.@@@...@@@..@..@@..@.@@@@@@.@@@@@@.@@@@@.@@@@@..@@@.@@@@.@@.@@.@@@@@@@@@...@.@@@
|
||||||
|
@.@@@@@.@.@.@..@.@..@..@.@@@@@.@@@@@@@@@@.@@@@@@@.@.@@.@@@@@@..@@.@.@@@.@..@.@@@..@.@@@.@@@..@@@.@@@@@@.@@.@@.@.@@@@..@@@@@@@...@@@@@@...@@@
|
||||||
|
.@@@@@@.@@@.@@.@@@..@@.@@@@@@@.....@@@@.@@@@@@@@.....@.@@@.@@@@@@@..@.@@@@..@@.@....@.@.@.@@@@@@@@.@..@..@..@@@@..@@...@@@.@@@@..@@@@..@@@@.
|
||||||
|
@@.@@@@.@@@@@@.@@.@@.@@@@@@@@@@@.@@.@@..@@@@.@@@.@@.@@@@@.@.@@@@@@..@@@.@@@@@.@@.....@@@.@@.@@@@@@@@.@@@..@@..@@.@@.......@.@@@@...@@@@.@@..
|
||||||
|
@.@.....@@@...@@@.@@..@.@@@@@.@...@@.@@.@@@@@.@@..@@@@@@@@@@@.@@@.@@.@@@@..@...@@@..@@@.@.@.@.@.@@@@..@@....@.@..@.@@@.@..@....@.@@.@.@.@@@@
|
||||||
|
@@.@@@..@@@@@.@.@@.@@@@@@@@.@..@@@@..@@@@@@..@.@@.@@@@@@@@@@@@@..@@.@@@@.@@.@@.@@@.@@.@.@@@@@@@.@@.@@.@@@@@@@.@@....@@@...@@@@@@@@@..@@.@.@@
|
||||||
|
@..@..@@@.@..@@@@...@@.@.@...@.@@.@.@@.@.@.@.@@@@@.@.@@@@@@@@@@@..@@.@.@..@@.@@.@@.@.@.@@.@@.@@@.@@@..@..@@.@@.@@@@..@...@@@.@@@.@.@@@@@.@@@
|
||||||
|
@@@.@@.@.@.@@@@@.@@@....@@@@@@@.@@@@.@@..@@@@@@.@.@@.@.@.@@@.@.@@@@@.@@@...@@@.@.@@...@.@@.@@@@..@@@@.@.@..@@@@.@@.@@@@@@@@@@..@@@@.@@@.@@.@
|
||||||
|
@@.@@@..@@..@.@@@..@.@@@@@.@..@@@.@.@@.@@.@@@.@@@@@@.@@.@@.@@@@.@.@@@@@.@@@@.@@.@@@.@@..@@@@.....@@@@.@@@@@@@.@@@.@@.@@@@@..@@.@@...@@@@@@.@
|
||||||
|
@@@@.@.@@@@.@@.@@@@@..@.@@@@.@@.@.@@@@@@.@@.@@.@@.@@@.@@.@@@.@@@.@@@...@@@@..@@.@@@@@@@@@..@@@..@.@.@.@@..@@.@@@@.@@@.@.@@@..@@@.@@@@@@@@@.@
|
||||||
|
@@.@@..@@@.@@.....@...@@@.@@.@.@..@.@.@@@@@@.@.@@.@.@.@@.@.@@@@@@@@..@@@@.@@@.@.@@..@.@.@@@@@@@@@.@@@@@@.@.@..@@..@...@......@@@.@@.@@@@@@@.
|
||||||
|
@@@@..@...@@@@.@@@@@@@@.@@...@.@...@@@@.@@@@@@@@.@@@..@@.@@@@@.@@@@.@.....@@.@@.@.@..@.@@.@@@@@.@@@@@.@@@@@@@.@@@@..@@@@@@@@..@..@@.@@.@.@@@
|
||||||
|
.@@@@@@.@@.@@@@@@@.@@.@@.@.@@....@@.@.@@@@@@..@@@.@.@.....@.@@@@@@@@.@@@...@.@@.@.@@@@@.@...@@..@@.@@@@..@....@@@..@@@..@..@@@@@.@@....@@..@
|
||||||
|
@@@.....@.@@@@@@@@@.@@@@@@@@.@.@@.@@@...@@@.@@@.@@@@@@@.@@@.@..@@@@.@@@@@.@@@@.@@@@.@@.@@@@.@.@@@.@..@@@@.@@..@@.@.@.@@.@@..@@.....@@@@@@@.@
|
||||||
|
@@@...@.@@.@@@@..@@@@@.@@@@@@@...@@..@@@.@.@@@.@@..@@@@.@@@@.@@.@@..@@..@.@@@@.@@@..@@@@.@@@@.@@..@@..@.@@@.@..@@@@@@@.@.....@.@.@.@..@@@@@.
|
||||||
|
..@...@@.@@@@.@.@.@...@@..@@.@.@@.@@@.@@@@@@@@.@.@@...@.@@@@@@@@.@.@@@@@@@.@@@@..@@@@@@@@..@@@@@@.@@@...@@@@..@@.@@@..@.@@@@@@@.@@@..@@@@@@@
|
||||||
|
.@.@.@.@@@@@@@@.@@@@@..@@..@@...@.@.@@....@@...@@@....@@.@.@.@@.@@.@@.@...@@@...@..@.@.@.@.@@@.@@@.@@.@@@@@@.@...@.@@@@@@.@@.@.@@@@@@@@.@@@.
|
||||||
|
@@@..@@.@@@@@.@.@@@.@@@@..@....@..@@..@@@.@.@@@.@@...@@.@@.@.@@...@@@.@@.@@@@@.@.@.@@@.@@.@@@...@@.@....@@@.@@@.@@.@@@@.@@.@.@@@@@@.@@...@@@
|
||||||
|
@@@@.@.@@@@@@.@@.@@@@@@@@.@@@@@@@@@@.@@@@.@@@@.@@@.@.@@.@.@@..@@.@.@@.@@@..@@.@...@@.@@..@@@@.@@.@@....@@@...@@.@..@@@@@.@.@.@.@.@@.@@@.@@@@
|
||||||
|
@@@@@...@@@@.@.@@..@@@.@..@@@.@.@.@..@@@...@@.@@@..@@.@@..@.@@@..@@@..@@@@@...@@@@@.@@@...@@@@.@.@..@.@.@@.@@@...@@@@@.@@..@@..@@@.@@@@..@..
|
||||||
|
..@@@@..@@@@@@.......@@..@.@@.@@@...@@.@@@@@.@@@@.@...@@@@.@@.@@.@@@@.@@.@.@.@@@.....@@...@@@@.@@@..@@@.@.....@..@@@@...@@@@@@..@@@@@.@..@@@
|
||||||
|
@.@@@@@.@@...@.@@@@@@@@.@@@@@...@.@.@@@@..@.@@@.@@@.@@.@@.......@@.@@@@.@.@@@@@@@.@.@@..@@@@.@.@@.@@@@@..@@@.@.@...@.@@..@@@@@@.@.@@@...@@..
|
||||||
|
@@@..@......@.@@@...@@@@.@..@@@@@@.@@@..@@@@@@@@@@@@@.@@@@@@@@@.@.@..@.@@@..@.@.@.@@@@.@@@@..@@.@@..@..@@@@@@@@@@@@@@@@@@@.@@..@@.@@@@@@@@@.
|
||||||
|
.@@.@@@@@@@.@@.@@@@.@.@..@@@@@..@...@..@...@@@@@@@@@@....@...@@..@@@.@@.@@@@@@@.@@...@@@@.@@@@..@...@@@.@@.@.@@@@@@@.@.@.@@@@@@@..@.@..@@@..
|
||||||
|
@@@..@..@@.@.@@@.@@@.@@.@@@.@.@.@.@@.@@@@..@@.@.@@.@..@@@@@@.@@@..@@@@@@@@@.@@@@...@@@@@@.@@@@@.@...@@.....@.@.@@.@.@.@@@@@@@.@..@@@@.@.@@.@
|
||||||
|
@@@@@@@@....@..@.@@@@.@@@@.@@@@.@@@.@@@@.@@@@@@@.@@@@.@.@.@@@@@@..@@@@@..@@@@.@.@@@@@@.@.@.@@@....@...@.@.@.@@....@..@@@@@@@@@@@@@@@@@@.@@@@
|
||||||
|
@.@@@@@@@@@@...@@@.@.....@.@@@..@@.@.@@.@.@.@@@@@@@@@@@@.@@.@@@@...@.@.@@.@...@@@@..@@@@@@.@@@.@.@@@.@@.@.@@@@@@@@@.@@@...@@@@@@@@.@@@.@@@@@
|
||||||
|
@@@.@.@@@.@.@@@..@@@..@@@.....@.@.@@@@@..@@@..@@...@.@.@@.@.@@@..@..@@.@.@@..@@@..@@.@@@@..@..@@.@@@@@..@@@@@@.@@@@@@@@@.@@@@...@@..@@@@@@@.
|
||||||
|
.@.@@@@.@@@@@.@..@@@@....@@.@.@..@@@.@@.@.@.@.@@@@....@.@@@@...@@@@@@@...@@.@..@@.@@.@.@@.@.@@@@@.@.@....@@.@@@.@.@@...@.@@@@@@@.@@.@@@...@@
|
||||||
|
@@..@@@..@@@@.@@@@@..@.@@.@@@..@.@@@@@@@....@.@@@@.@@..@@...@..@@.@@@.@.@@@@.@@@@.@@..@@.@@@@...@@..@@@@@@@..@@.@@.@@...@@@@.@@@@.@@..@@@@.@
|
||||||
|
@..@@.@..@.@@@...@@@@.@..@@@.@.@@@@@.@@@.@@@@.@.@.@..@@..@@@.@@@@@...@@.@..@@@.@..@@.@.@@@@@@@@@@@@@@@.@@@@@...@@@.@@.@@.@@@@@@@.@..@.@@...@
|
||||||
|
@..@..@@@.@.@@@@.@...@@@..@.@@@@.@@@@.@@@.@@.@@@..@@@.@@@.@@@@@@.@.@@@@@@@.@@@..@@.@.@@..@@..@@@@.@.@@@.@@@.@@@..@..@@..@@@@@...@@@@....@@@.
|
||||||
|
@.@.@@@@.@@.@@@@@@@..@..@.@@@@.@.@..@@@@@..@...@@@..@@@.@.....@@...@..@.@@@.@@..@@.@.@@.@@@@@@@@@@.@.@@.@@@@......@.@.@.@@.@.@@.@@@@@@.@@..@
|
||||||
|
@.@.@.@@@@@@.@.@@@@.@@@@.@..@@@..@@@@@@@@@@.@@.@@@@..@.@......@.@.@@@@...@@@@@@..@.@@@@@@@@@@@..@.@@@@@.@@.@@@.@@@....@....@@@@@@@.@@.@@.@@@
|
||||||
|
@@@@@.@@.@..@@@@@@@.@@.@@@.@@.@@@@@@..@..@@@@@@@@@.@@@@@@@.@@@@..@@@@..@@..@@@.@@@..@.@@@..@@@.@.@@@@@@@..@@.@@.@@@.@@.@@@.@@@@@@@@@@@..@@@@
|
||||||
|
@@@@....@.@.@.@.@.@@@@@.@@..@@@@..@@@.@@@@@@@@@@...@@@..@@@@..@@@@@.@@@.@@.@@@@@.@..@....@.@.@@@...@@@@.@@@@@@.@@.@@@.@@....@.@@@@@@@@...@.@
|
||||||
|
@.@@.@...@.@@@@@..@@@@.@@@...@@@@@.@@@.@....@@.@@@..@..@@.@.@@@.@@@...@@@.@@..@.@@@.@@@@.@@..@..@.@..@...@@@@...@@@..@..@@@@..@@.@@..@@@@@.@
|
||||||
|
@@.@@.@@@@.@@@..@@@.@@.@@@.@.@...@@.@@@@.@@...@.@....@.@@@@.@..@@.@@@@@@@@@@@.@@..@@.@@@@@..@.@..@@@@@@@.@.@@.@@@@@@@...@@@@@..@@@@@@.@@@.@@
|
||||||
|
..@..@@@@@@@@..@@@.@...@.@@@.@@@....@@@@...@@@@@@.@.@@@.@@@@...@@@@...@@.@@.@.@@@@@@@.@..@.@@@@@.@@@@@@@@@@.@@@@@@.@..@@..@@@@@.@@@@@@.@.@@@
|
||||||
|
..@.@@@@@@..@@@@@.@.@@@..@.@@@@@.@@@.@..@@@@@@@.@@@@.@@@@@@@...@@@@..@.@@.@@@..@.@@@@@@...@@@@@..@..@@.@@@.@@@@@@@@..@@@@@@@@@.@..@.@@@..@.@
|
||||||
|
.@@@.@@@@@@.@@@@.@@@@@@.@.@@@.@.....@@.@@@@.@..@..@.@.@...@...@.@.@@..@@@@@@@.@@.@@.@.@@.@.@@@@@@@.@@@....@@.@@@@@@@.@@@@@@.....@..@@@.@@@.@
|
||||||
|
..@...@@.@@@@..@@@@@@@.@.@.@@@@@@@@..@.@@@.@@@.@@@.@@@@@@@..@@@...@@@.@@@..@.@.@@@@@@...@@@.....@@@@@@@..@@@@@@@@@@@..@@@@@..@@@@.@.@.@@@.@@
|
||||||
|
@.@..@@@.@@@@@@..@.@.@...@@@@@@@..@@@@@@@@@@@@@@..@@.@@.@@...@..@@.@@..@@...@@@...@@@@@@@@@@@@...@@@.@@@@@@@@@...@.@@@....@@@@@@.@@@.@@@@@@@
|
||||||
|
.@@@.@@@@@@.@@.@@..@@@@@@.@.@..@.@@.@@@@.@@@..@.@@@.@@@@.@@@@@..@@..@.....@.@@@@@@....@@@@@@@@..@@@@@..@..@@.@....@.@@@.@..@..@.@@...@@@@.@@
|
||||||
|
@@@.@.@@.@@.@..@.@.@@@@.@.@@...@@.@.@.@@@@@...@@@@.@@.@@@..@@.@@@.@@@.@...@@.@.@@.@@.@@...@@.@@..@@.@.@@@@@@@@.@@...@@@@@@@@@@@.@@..@@@@@@..
|
||||||
|
.@.@.@@..@.@.@@.@@@@@..@@.@@@@.@...@@@.@.@@.@@@.@@@@@@@@..@@..@@@.@@@..@.@@.@.@@@@@.@@@@@@..@@@@@@@@@@@@.@@@@.@@@.@@@.@@@.@@@@..@.@@@@.@@.@.
|
||||||
|
.@@@.@..@.@@..@@@.@@@@.....@@@@@@@@@@.@.@.@@@.@@@@@....@@@.@@@.@@...@@@.@@@..@.@@.@@@@@@.@...@@.@.@@@.@..@@@@@@..@@@@@..@.@.@..@@.@@@@@@@@@@
|
||||||
|
.@.@@@.@.@@@.@.@@.@@.@@..@.@@@.@..@@..@@@@@.@.@..@.@..@..@@.@@@.@@.@@...@@@@@@@.@.@@@.@@...@.@@..@.@.@@@@@@@@@@@@@@@@@@@.@.@@@@@..@..@@@@@@.
|
||||||
|
...@.@.@@.@@@@.@.@@......@.@.@..@@..@@@.@@@@....@@@.@...@.@@.@@@@@@@@@...@@..@.@.@.@@...@@.@@.@...@@.@..@@.@.@....@@..@@.@@@..@@.@.@@@..@@@@
|
||||||
|
@.@@@...@.@@@@.@@.@..@@@@..@@@@@@@@..@@@...@@@@@.@...@@@@@@@@@@...@@@@@@@@@@.@@@@@@@@@...@@.@@..@@.@@..@...@@@@@@@.@@..@.@.@.@.@@@.@.@.@.@@@
|
||||||
|
@@.@@.@@@@....@.@...@...@@@@@@@.@@@@@@@@@@@.@@@...@@@@@@@@@@@@@@@.@@..@.@@@.@@@.@@@@..@.@@@@..@@@@..@.@.@@.@@@@@@@.@@@@@@@@.@.@@@@@@@@@@.@@.
|
||||||
|
@@@@@..@@..@@@@@.@@@.@@@@@.@@@@@@@.@@@@@.@@..@@@.@.@@@@@.@.@@@..@@.@...@@@.@@..@.@.@@@.@.@@@@@@..@@@@.@@@@..@@..@@@.@@@@@.@.@...@@@@.@@...@@
|
||||||
|
@....@@@@@.@.@@@..@.@.@@.@..@.@@.@@@@.@@@...@@.@@@@..@.@.@.@@.@@.@@.@@@.@.@.....@@@@@.@.@@@..@..@.@.@@.....@@@@@....@..@@@@@@@@@@@@.@@.@@@.@
|
||||||
|
@@@@@@...@@@..@.@@.@..@.@@@@.@@@@@.@@@@..@@@@.@@@@@@..@..@@@@@@..@.@@@..@.@@.@@@@.@@.@@..@@@@..@..@.@@.@.@@.@@.@@@.@@@.@@@@@@@@....@@.@@.@@.
|
||||||
|
@@@@@@.@@@.@@@@@@@..@@..@@@.@@@@@@@@@@@@.@@@.@@.@.@@@.@@@.@@@@.@@@@@.@.@.@@@..@@@@@@@@..@@@@@.@@@@@.@@@..@@.@.@@@.@@@@..@@@.........@@@@@@@@
|
||||||
|
@@@..@.@@@@..@@@@@.@.@@@..@@.@..@@..@@..@.@@@.@@@.@.@.@..@@@.@.@@.@@.@...@@.@@@@.@.@.@@..@...@.@.@@@@...@@@....@@@.@@@@.@.@@@@@@.@@@@.@@@@.@
|
||||||
|
@@.@@@@@@@@..@.@.@@@@..@.@@@@@.@@@@@@@@@.@@@@@@.@@@@.@@@@@@.@@@@..@@@...@@@.@@@@.@@.@@..@@@@.@.@.@.@@@@@@...@@@.@...@.@.@.@@@@@@@@@@.@@@@@@@
|
||||||
|
@@@@@.@@..@@.@@.@@@@@@@@.@@@@@...@..@@@@.@@..@.@..@@@..@@.@@@@.@.@@.@.@@@@.@@@@@.@..@@.@@.@@@.@@@@.@@@@..@@@@..@@@@@.@@..@.@@@@@@.@..@@@.@@@
|
||||||
|
@.@@...@..@@@@@@@.@@..@..@.@@.@@..@...@..@.@.@.@.@@@@..@@@.@.@@@.@..@...@.@@@.@@@@..@@.@@@@@.@@..@@@@.@.@@@....@@@@.@..@.@@@.@.@@..@.@@..@@@
|
||||||
|
@@@.@@@..@@@@.@..@@@..@@.@@@@@....@.@@@@...@@@@@@..@.@@@..@@@@@@@.@@.@.@@...@.@@@.@..@@..@.....@@@@..@@.@@@@@.@..@.@@@@@@@@..@@@..@@@.@@..@@
|
||||||
|
.@@@..@.@@.@.@@@@.@@..@.@@@@@@@@.@@.@@@@@@@.@@@...@.@.@@.@.@.@@@@@@@@@..@@@@@..@@...@.@.@@.@@@@@..@@.@..@.......@@@@@....@.@.@@@@.@@..@@@.@.
|
||||||
|
.@..@@.@@@..@@@.@@@@@@.@.@...@@@@@@..@@.@@@@@@@@.@.@@@@@@@@..@@@@.@@..@@@@@@@@.@@@..@@@@.@.@@.@.@@@.@@@..@@@..@.@@.@..@@@.@@@.@.@@...@.@@.@.
|
||||||
|
@@@@.@@@@@.@@@.@.@@@.@.@....@..@.@@@@@.@..@@@@...@.@.@@@@..@@.@@@.@@..@@@..@@@.@...@@.@@@@@.@@@.@.@@@.@...@.@..@.@..@@@@@.@@@@@@@@.@@.@@.@..
|
||||||
|
..@@@..@@@@@@@@@@@@..@@@@.@@@.@@.@@@..@@@.@.@@@@@.@.@@@@.@@@@.@.@@@@@@@@@.@@@.@@..@@@@@..@.@@.@.@@@..@.@.@@..@.@.@@@..@......@@@@.@@@@.@.@@@
|
||||||
|
@@@@.@..@.@...@.@.@@@@@.@@@..@@@@.@@@..@@@@.@...@@..@@@..@.@@.@@@@@@.@@@.@@@@@@...@@.@@@..@.@@.@.@.@@@@.@@.@@@@.@@@@@@.@@@@@@@@@..@@..@.@.@@
|
||||||
|
.@.@@@@..@.@.@@@.@..@@@.@.@@@@.@.@.@@..@.@@@@..@...@@@@@@@@@.@@..@.@@@@@@@@.@@..@.@@@.@.@.@@@.@@@@@.@.@@@@@@..@.@.@.@@@@@@.@@.@@@@@.@@.@.@@@
|
||||||
|
@..@@@@@@@.@@@@@.@.@@@@.@@@..@@.@@@...@..@@@@@.@@.@@@@@..@.@@.@..@@@..@@..@@@@@@@@@.@@@@@..@@@@@@@@@.@..@@.@...@@@.@..@@.@...@@@.@@@.....@@@
|
||||||
|
...@@@@@@@.@.@@@.@.@@.@@@.@@@@@..@@@@@@@@..@..@.@.@@@.@@@@...@.@@..@..@.@@.@...@@.@@.@.@@@@....@..@@@@@@@@...@@.@.@.@@@@@..@@@@@@.@..@@@.@@@
|
||||||
|
.@@@.@.@@....@@@..@@@@@@@..@...@@.@@@@.@@@@@.@@.@..@@@..@@.@@@@@.@..@@@..@@@@@@@.@.@@...@@@..@@@@@@..@@@@..@@.@@..@.@@..@@.@@@@.@@@@@@@@@@@@
|
||||||
|
....@@.@@@.@.@@...@..@.@@@.@...@@@@.@.@@@@@.@@@@...@@..@@.@@@.@..@@....@..@@@@@.@@@.@@@..@.@...@...@.@@@@.@..@@.@.@@@..@.@@@@@@@@@@.@@@@...@
|
||||||
|
.@@@...@.@@@@....@..@@@@@@@@@@@@.@@@.@@@@@@@@@@@...@.@@.@@.@@.@..@@@@.@@@@@@@.@@@..@@@.@@@@@.@@@..@.@@.@.@.@@@@@@.@@@@@@@.@.@..@@@@@.@@.@@..
|
||||||
|
.@@@@@@@.@@..@..@@@@@@@@@.@.@@@@@.@@@@.@@@..@@.@@..@@.@@@@..@@@@@@@.@.@@@@@@.@@.@@@@@@@@@@@@@@.@@.@@@@@@@@@@...@..@@...@@@@..@@.@..@..@@@@@.
|
||||||
|
.@@@@.@@.@@..@@@.@@.@.@@@.@.@.@@....@@@..@@.@@@@@@@@@@.@@@@@.@.@@@...@@@@@@@@....@@.@@@.@....@@@@@.@@@@.@@@..@@...@...@.@@@..@@@.@@@@@@@@@..
|
||||||
|
@.@@@..@@.@@@..@@.@.@.@..@@@@@@@@@@@@..@.@@.@@@@@@@.@@@@@@@@..@.@@.@.@@@..@@@..@.@@@@@@..@@.@@.@@@@.@@@...@@@@...@.@..@@.@@@.@.@@@@@@@.@@@@.
|
||||||
|
..@@@@.@@.@.@.@@@.@@@..@..@@@@@@..@.@@@.@@.@.@@@@@.@@.@@@@@...@.@.@@.@.@@@@@.@@@@@@@@@@@@...@.@.@@@..@.@@@@@@..@.@..@@@.@..@.@.@@@.@.@@@....
|
||||||
|
..@@@.@..@@@.@@@..@@.@.@@@@.@@.@@@@@@@@@@.@@@@.@@.@@@@@.@..@...@@..@@@....@@@.@.@..@@@@@.@..@@..@@.@.@@@@..@@@@@.@.@..@@.@@.@@.@@@@..@@@.@@.
|
||||||
|
@@.@@.@.@@@@@@@@@.@@.@...@@@@@..@@@@.@.@@@@@@@@.@@@.@@.@...@@..@@@@@.@..@@@@.@@@.@..@@@@@..@@@@@.@@@.@@.@@@@.@@@@@@@.@@.@@.@.@..@.@@..@@@@@@
|
||||||
|
@.@@..@.@@.@..@@@@@@@.@@.@@.@@@.@.@.@@@...@.@...@.@...@.@@@@@..@.@@@@@@@.@.@.@@..@.@.@@.....@.@@@@@@@@@@@@@.@@.@.@..@.@...@@@..@@@@.@@@@@...
|
||||||
|
@@@@@@@@@@@@@@.@.@@@@@.@.@@@@@@@@.@@.@.@@@.@@@@@@@..@@@@.@@@@.@@@@.@@.@@@@.@@@@@@@@.@@@@@@@.@@.@.@..@@.@.@@..@..@.@@@.@.@@.@@.@.@.@@.@@@.@@@
|
||||||
|
@..@...@..@@@@@.@.@@@@@@@@@...@@@.@@@.@@.@@@@@@@.@..@@@.@@.@..@@@@.@@.@@@...@@@@@@@.@.@.@@.@@....@@....@.@@.@@@@..@@@@@@..@..@@@.@.@@@@@@.@.
|
||||||
|
@.@.@..@..@@..@@@.@..@@...@@@@@@@.@@.@.@..@..@....@@.@@.@..@@@...@@@@@@.@@@@@@.@@.@.....@@..@.@.@.@@@.@@.@.@@..@@@.@@@@@..@@@..@@.@..@..@@@.
|
||||||
|
@@@@..@.@.@@.@..@@@@@@@..@.@@@.@@.@..@...@@@@@.@.@@@@@..@@.@@@@@@@.@@@@@.....@.@.@..@.@@..@..@@@@@@.@.@..@..@@@@@.@.@@@@.@@@@@..@@.@.@..@.@@
|
||||||
|
@@..@@@@@@@@@@@@@....@..@@@@@@@.@@@@@@.@@@@.@.@@@@@@@@@@@..@@@@..@.@.@..@@@@..@@.@..@.@@@@@....@@@@@...@@@.@@@...@.@.@.@@@.@.@@@.@.@.@@@.@.@
|
||||||
|
@@@@.@.@@@...@..@.@..@@@@@@@@@.@.@@..@.@@@..@@@@@@@.@.@.@@@@.@...@@@@@@@@..@.@....@@.@@..@@...@@.@@.@@@.@.@..@.@@..@..@@.@@..@@@@@@@@@.@@@@@
|
||||||
|
@@.@.@..@@@.@@.@..@.@.@@@@@@@@..@@.@@.@.@@.@.......@.@@...@..@..@.@@.@@@..@@..@..@@@@@@@..@@.@@.@.@@...@@@@@@.@@@@@@.@..@..@@@.@@@.@@.@@@@..
|
||||||
|
@@@...@....@.@.@.@.@.@@....@@@@@.@@@...@@@@@@.@@@..@@.@@..@.@@.@@@@.....@..@@@.@..@.@@.@@.@@@.@@@.@@@@@@.@@@@@@.@..@@@.@@..@@.@@@@@@@@@..@@@
|
||||||
|
@@.@@.@.@@@@@.@@.....@@@.@@@@..@@..@.@...@@@..@@.@@@.@@.@@@.@.@@.@.@..@..@@@@@.@.@@@@.@..@.@@.@@..@.@@@@@@@..@@@..@.@@@...@@@..@@@@@......@.
|
||||||
|
.@@..@@@@@@@.@.@@@@@@@@..@@@@@@@..@.@@@....@@@..@..@@@..@.@.@.@@@@@.....@@.@@@@@..@@@@..@.....@..@@@@.@@@.@@@.@@@@.@@@@.@.@..@.@.@...@@.@.@@
|
||||||
|
@.@@@.@.@@@@....@.@@@..@@..@@.@@@@@.....@@.@@@@@@@..@@@@@.@.@..@@@@@@@....@.@.@@@@@@.@@@@@@@.@@.@.@@@.@@@@@@@@@.@@@@.@@@.@@@.@@.@.@@.@@.@...
|
||||||
|
.@@.@.@@@@@.@@....@@@.@@@@@@.@@@.@.@@..@@@.@.@..@.@...@.@@@..@.@......@@@@@@@@@@@.@.@.@.@@@.@.@@....@@@..@@@.@@@@@@@...@@@@@.@@@@@@.@......@
|
||||||
|
.@@.@@....@..@@@@.@@@.@.@.@.@@.@@@.@@@.@@@.@@...@@.@@@@@.@@@@..@@.@..@@@@@@@@@.@@@@@@@.@..@@@.@.@@...@@@@@@@.@@@@@@@@.@.@@@.@@@@@@.@@@@.@@@@
|
||||||
|
..@@@@.@.@@...@@..@@@...@@.@@@@@@@@@@@.@@@..@@@.@@.....@@...@@@.@@.@..@..@@.@.@@@.@.@@@.@.@@@@@.@@.@@@..@@@@@@@@@@..@.@@@@@@@@.@@.@@@@..@@@.
|
||||||
|
.@@.@@@@@@..@@@@@.@.@@@@@@@.@@@@..@@.@.@@...@@@...@..@@....@@.@.@@@.@.@@@..@@@.@@...@.@.@@..@@..@@.@@@@@@@@@.@@.@@@@@@@@@@..@.@@@.@.@@@.@@@.
|
||||||
|
@.@@.@..@......@@@@@.@@.@@.@@@@@@@@.@.@@.@.@@..@...@...@.@@@.@@@.@@@@@.@..@.@@@@@@@.@@@@@@..@@@@..@@@.@.@@@@..@..@@@@@..@@.@@.@@..@..@@.@@..
|
||||||
|
@@.@@.@@@@@@.....@@@.@.@@.@@@@.@.@@..@.@.@@.@@@.@..@.@@.@@@@.@@@@@..@@..@@@...@.@.@@@@..@@@...@@@.@@@@@.@..@@@@@@@@@..@@.@@@@@.@@@@@@..@@.@.
|
||||||
|
....@@@@.@....@@@@@@@@..@@@@@@.@..@@@@..@.@@@@..@.@@@@@@@@.@@@@@@@@@@.@@@@@@@@@@@.@.@@@.@.@@.@@.@@@@.@...@@.@@@@@@@@.@@.@.@@..@@@.@.@.@.@.@@
|
||||||
|
.@.@.@.@.@@@@@@.@@..@@...@.@@.@@@.@@.@@@.@.@@.@@.@.@@@.@..@@.@......@@@@@...@..@@@@@@@@@.@@@@@@@@@@....@@@@.@...@@@.@@@@.@.@@@@@.@@@...@.@@@
|
||||||
|
@@.@@.@@@@.@@@@.@..@......@@@.@.@...@@.@@@.@@@@@@@@@@@@@..@@@.@.@...@@@@@.@@.@@@@..@.@@@.@.@@.@@@@.@..@.@@@@.@@..@@.@..@@@.@@@@@.@@...@@@.@.
|
||||||
|
.@@@@.@@@.@@@@@@@@@@@@@@.@@@@@@@@..@.@@@@@@@.@@.@@@.@.@@.@@@.@@@@@@.@@@@.@@.@@@@.@.@@.@@@..@@@.@.@@@....@@.@..@@@.@.@@@..@@@@.@@..@.@.@@@@.@
|
||||||
|
@@@..@@@@.@@..@@@@@@@@@..@@.@.@.@@@@@@.@@.@@.@@.@.@@@@@.@@..@.@@@.@.@@@@.@@....@@@@.@...@@.@..@@..@..@@@@@@@@.@.@@@.@@.@..@.@..@.@.@@@...@.@
|
||||||
|
@.@@@..@..@@@.@@@@@@.@@@@@@@.@.@.@.@@@..@.@@@.@@@@..@..@@.@.@@@@@.@.@@.@.@..@@.@@@@@@.@.@.@@.@@@@@@@.@@@..@@...@@@..@@.@@@.@@@@@@..@@.@@.@@@
|
||||||
|
.@@@@@.@@@...@@@@.@..@@@..@@..@.@@@@..@........@@@.@@.@@.@.@@@.@@@@...@@@@@@..@@@.@.@...@@.@@.@@.@@@...@.@@@.@@.@.@@.@..@@..@.@@@@@@@@...@@.
|
||||||
|
@@@...@@@@@@@@@@....@@@@@.@.@.@..@..@.@@...@.@.@..@@@@.@.....@@.@..@..@...@@@@.@@.@@@@@@@.@@.@@.@@@@.@@@@@.@@.@@.@@@@@.@@@...@@@@@.......@..
|
||||||
|
@@@..@..@@@@@...@@@@@@@@.@@.@@@@@.@@.@@.@@@@...@.@@@@@@@@@@@@@@@..@.@@..@@@.@....@@.@@@@@.@@@.@@@@@..@@@@.@@@@.@@.@....@@@@..@@@@@@@@@@.@..@
|
||||||
|
@@.@@@@@@@..@@.@@@@..@@@@.@@@@@.@@.@@.@@@@@@@.@@@@@.@.@...@@@..@.@@..@@@@@..@@@@@.@@@@.@@@@.@.@@.@@@@@@.@@@@.@@.@..@.@@@..@.@@@.@@.@@@@.@.@@
|
||||||
|
..@@..@.@@@@@@.@@.@@@@@@@@@.@..@.@.@@..@.@@@@@@@@@@@@.....@.@..@@@...@@@.@@..@@.@@@.@.@@@@@@.@@@....@@.@@..@@.@@@@@.@@..@@.@@@@@@..@@@.@@..@
|
||||||
|
@@..@.@.@.@@.@@.@@@@@.@..@@...@.@@@..@@..@@@.@@@..@@.@@@@@@@....@.@@@@@@..@@.@@.@@..@.@@@@@@...@@@@.@@@....@@@..@@..@@..@.@@.@....@@.@.@@@@.
|
||||||
|
@...@@.@@@.@.@@@.@.@@@@@@@...@@.@@.@@@..@@@@.@@@.@@@.@.@.@@@@@@.@..@@@@@@@@@@.@@.@.@@.@.@.@@@.@@.@@@..@.@@@.@.@.@@@@..@...@..@@@@.@..@.@.@@.
|
||||||
|
..@@@@...@@@.@@.@.@@@@@@@..@@@.@.@@@@@.@@@@@@@@@.@..@@@@@@.@@@.@...@@.@@@@@@@@.@.@.@..@@@@@..@@@.@.@.@@.@@...@.@@....@@@@@.@@@@.@..@..@@@@.@
|
||||||
|
.@@.@@...@.@.@..@.@@@@.@@@.@.@.@.@@@..@@@.@@@@@@@@@@@.@.@@@@@.@@@.@.@@.@.@.@.@@.@@@@.@@@.@@@@..@@@@@@@@@@@...@@@@@.@@@@...@...@@.@@.@@.@@.@@
|
||||||
|
.@...@@@@.@@@.@@..@@@@@@@.@......@@.@..@@@@@@.@@@@.@@@.@@@@..@@...@.@@@@@@@.@.@@..@@.@..@@.@@@@@@..@@@@@@@@@@@@@@...@.@.@@@@@.@@@.@@.@@@..@@
|
||||||
|
@@.@@.@.@@.@@.@.@@..@@.@@..@...@.@@@@.@@@..@@@@.@@@@@@@@..@@@.@@.@..@@@@.@@@.@..@@@@@@@@@@@..@@@.@...@@..@..@@@@.@@@@@.@@@@@@...@@.@.@.@@.@@
|
||||||
|
@@.@@@.@@@@@@.@.@@@@@@@.@@@@@@@@@..@@.@..@@@@.@..@.@@.@@@.@.@.@.@@@@.@.@.@.@.@@.@.@.@@@@@@@@@@@..@@......@@@.@@.@@@@@@@@@@@..@..@..@@@@@@@@@
|
||||||
|
@@@@.@@.@@@.@.@.@@@@..@@@@@@@@@..@..@.@@@.@@@@@..@@@@@.@@@@@..@@@@.@@.@...@@...@@.@..@..@@@...@..@...@@.@@@.@@.@..@@..@@@@@@@@@@@@.@@@@.@@@.
|
||||||
67
04/main.py
Executable file
67
04/main.py
Executable file
|
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/python
|
||||||
|
|
||||||
|
from logging import debug, DEBUG, basicConfig
|
||||||
|
from sys import argv
|
||||||
|
|
||||||
|
|
||||||
|
def parse_input(input_filepath: str) -> list[str]:
|
||||||
|
grid: list[str] = []
|
||||||
|
|
||||||
|
with open(file=input_filepath, mode="r") as input_file:
|
||||||
|
input_data: list[str] = input_file.readlines()
|
||||||
|
|
||||||
|
debug(f"\n\nRAW INPUT: {input_data}\n\n")
|
||||||
|
|
||||||
|
for line in input_data:
|
||||||
|
grid.append(line.strip())
|
||||||
|
|
||||||
|
return grid
|
||||||
|
|
||||||
|
|
||||||
|
def is_accessessible(grid: list[str], row: int, col: int) -> bool:
|
||||||
|
if grid[row][col] != "@":
|
||||||
|
return False
|
||||||
|
count = 0
|
||||||
|
adjacent_spots = [[""] * 3] * 3
|
||||||
|
for x_offset in range(-1, 2):
|
||||||
|
for y_offset in range(-1, 2):
|
||||||
|
if (
|
||||||
|
row + x_offset < 0
|
||||||
|
or row + x_offset > len(grid) - 1
|
||||||
|
or col + y_offset < 0
|
||||||
|
or col + y_offset > len(grid[0]) - 1
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
adjacent_spots[x_offset + 1][y_offset + 1] = grid[row + x_offset][
|
||||||
|
col + y_offset
|
||||||
|
]
|
||||||
|
if grid[row + x_offset][col + y_offset] == "@":
|
||||||
|
count += 1
|
||||||
|
debug(f"ADJACENT SPOTS FOR {row}, {col}: {adjacent_spots}")
|
||||||
|
return count < 4
|
||||||
|
|
||||||
|
|
||||||
|
def get_accessible_paper_rolls(grid: list[str]) -> int:
|
||||||
|
count = 0
|
||||||
|
for row in range(len(grid)):
|
||||||
|
debug(f"CURRENT ROW: {grid[row]}")
|
||||||
|
for col in range(len(grid[row])):
|
||||||
|
debug(f"CURRENT VALUE: {grid[row][col]}")
|
||||||
|
if is_accessessible(grid, row, col):
|
||||||
|
count += 1
|
||||||
|
return count
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
input_filepath = "input/grid.txt"
|
||||||
|
input_grid = parse_input(input_filepath)
|
||||||
|
paper_rolls = get_accessible_paper_rolls(input_grid)
|
||||||
|
print(f"Paper rolls accessible by the forklift: {paper_rolls}")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if "-d" in argv or "--debug" in argv:
|
||||||
|
basicConfig(filename="debug.log", level=DEBUG)
|
||||||
|
main()
|
||||||
|
exit(0)
|
||||||
Loading…
Reference in a new issue