Skip to content

Commit

Permalink
Update walker_class.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 5, 2024
1 parent 8ae4660 commit 375de48
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions kyu_3/line_safari_is_that_a_line/walker_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ class Walker:
"""Walker class: make moves, check directions, etc..."""

def __init__(self, grid: list):
"""
Create a new Walker instance.
:param grid:
"""
self.__grid: list = grid
self.__is_start: bool = True
self.__position: dict = self.__get_start_point()
Expand Down Expand Up @@ -211,7 +216,7 @@ def __test_up(self) -> bool:
"""
row: int = self.__position['row']
col: int = self.__position['col']
if row - 1 >= 0 and self.__grid[row - 1][col] in 'X|+':
if row >= 1 and self.__grid[row - 1][col] in 'X|+':

Check warning on line 219 in kyu_3/line_safari_is_that_a_line/walker_class.py

View check run for this annotation

Codecov / codecov/patch

kyu_3/line_safari_is_that_a_line/walker_class.py#L219

Added line #L219 was not covered by tests
return True
return False

Expand All @@ -225,7 +230,7 @@ def __test_down(self) -> bool:
def __test_left(self) -> bool:
row: int = self.__position['row']
col: int = self.__position['col']
if col - 1 >= 0 and self.__grid[row][col - 1] in 'X+-':
if col >= 1 and self.__grid[row][col - 1] in 'X+-':
return True
return False

Expand Down

0 comments on commit 375de48

Please sign in to comment.