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 3c209d7 commit 1ba5f73
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions kyu_3/line_safari_is_that_a_line/walker_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ def __reset_direction(self) -> None:
for key in self.__direction:
self.__direction[key] = False

def position_plus(self, previous_position) -> None:
def position_plus(self, previous_position: str) -> None:

Check warning on line 144 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#L144

Added line #L144 was not covered by tests
"""
Process cells if current position is +.

Check warning on line 146 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#L146

Added line #L146 was not covered by tests
:param previous_position: dict
:param previous_position: str
:return: None

Check warning on line 149 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#L148-L149

Added lines #L148 - L149 were not covered by tests
"""
if self.position == '+' and previous_position in '-X':
Expand All @@ -166,11 +166,11 @@ def position_plus(self, previous_position) -> None:
self.__direction['up'] = self.__test_up()
self.__direction['down'] = self.__test_down()

def position_minus(self, previous_position) -> None:
def position_minus(self, previous_position: str) -> None:
"""
Process cells if current position is -.
:param previous_position: dict
:param previous_position: str
:return: None

Check warning on line 174 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#L174

Added line #L174 was not covered by tests
"""
if self.position == '-' and previous_position in '-X+':
Expand Down Expand Up @@ -216,27 +216,22 @@ def __test_up(self) -> bool:
"""
row: int = self.__position['row']
col: int = self.__position['col']
if row >= 1 and self.__grid[row - 1][col] in 'X|+':
return True
return False
return row >= 1 and self.__grid[row - 1][col] in 'X|+'

Check warning on line 220 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-L220

Added lines #L219 - L220 were not covered by tests

def __test_down(self) -> bool:
row: int = self.__position['row']
col: int = self.__position['col']
if row + 1 < len(self.__grid) and self.__grid[row + 1][col] in 'X|+':
return True
return False
return row + 1 < len(self.__grid) and self.__grid[row + 1][col] in 'X|+'


def __test_left(self) -> bool:
row: int = self.__position['row']
col: int = self.__position['col']
if col >= 1 and self.__grid[row][col - 1] in 'X+-':
return True
return False
return col >= 1 and self.__grid[row][col - 1] in 'X+-'


def __test_right(self) -> bool:
row: int = self.__position['row']
col: int = self.__position['col']
if col + 1 < len(self.__grid[row]) and self.__grid[row][col + 1] in 'X+-':
return True
return False
return col + 1 < len(self.__grid[row]) and self.__grid[row][col + 1] in 'X+-'

0 comments on commit 1ba5f73

Please sign in to comment.