Skip to content

Commit 94cdc82

Browse files
committed
Add methods that populates the _gears_positions list
1 parent 7dfbd77 commit 94cdc82

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

puzzles/solutions/2023/d03/schematic_parser.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,10 @@ def find_part_numbers(self) -> list[int]:
7777
is_adjacent_to_symbol = False
7878

7979
return [number for number, digits_positions in self._numbers]
80+
81+
def find_gears(self):
82+
for row, column in itertools.product(
83+
range(self._schematic_length), range(self._schematic_width)
84+
):
85+
if self._schematic[row][column] == "*":
86+
self._gears_positions.append((row, column))

0 commit comments

Comments
 (0)