@@ -40,7 +40,9 @@ class Solution(SolutionBase):
4040 (1 , 1 ), # down-right
4141 ]
4242
43- def find_open_spaces (self , grid : list [list [str ]], rows : int , cols : int ) -> list [tuple [int , int ]]:
43+ def find_accessible_roles (
44+ self , grid : list [list [str ]], rows : int , cols : int
45+ ) -> list [tuple [int , int ]]:
4446 """Find all accessible paper rolls in the current grid.
4547
4648 An accessible roll is one marked '@' with fewer than four adjacent '@' rolls.
@@ -87,7 +89,7 @@ def part1(self, data: list[str]) -> int:
8789 """
8890 grid = [list (row ) for row in data ]
8991 rows , cols = len (grid ), len (grid [0 ])
90- return len (self .find_open_spaces (grid , rows , cols ))
92+ return len (self .find_accessible_roles (grid , rows , cols ))
9193
9294 def part2 (self , data : list [str ]) -> int :
9395 """Count the total number of rolls that can be removed.
@@ -106,14 +108,14 @@ def part2(self, data: list[str]) -> int:
106108 """
107109 grid = [list (row ) for row in data ]
108110 rows , cols = len (grid ), len (grid [0 ])
109- positions = self .find_open_spaces (grid , rows , cols )
111+ positions = self .find_accessible_roles (grid , rows , cols )
110112
111113 count = 0
112114 while (c := len (positions )) > 0 :
113115 count += c
114116 for y , x in positions :
115117 grid [y ][x ] = "."
116118
117- positions = self .find_open_spaces (grid , rows , cols )
119+ positions = self .find_accessible_roles (grid , rows , cols )
118120
119121 return count
0 commit comments