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 Oct 31, 2024
1 parent af9d1c1 commit 21fac45
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions kyu_3/line_safari_is_that_a_line/walker_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ def __set_direction(self) -> None:
self.__reset_direction()
print(f'prev: {previous_position}, pos: {self.position}')

case_i = self.__get_case_i(previous_position)

if self.position == '+' and previous_position in '-X':
self.__direction['up'] = self.__test_up()
self.__direction['down'] = self.__test_down()
Expand Down Expand Up @@ -187,46 +185,6 @@ def __set_direction(self) -> None:
elif self.__position['row'] > self.__position['prev_row']:
self.__direction['down'] = self.__test_down()

def __get_case_i(self, previous_position) -> int:
"""
Get case i base on the current position vs previous_position
:param previous_position:
:return:
"""
i: int = 0

if self.position == '+' and previous_position in '-X':
i = 1

if self.position == '+' and previous_position == '|':
i = 2

if self.position == previous_position == '+' \
and self.__position['col'] == self.__position['prev_col']:
i = 3

if self.position == previous_position == '+' \
and self.__position['row'] == self.__position['prev_row']:
i = 4

if self.position == '-' and previous_position in '-X+' \
and self.__position['col'] < self.__position['prev_col']:
i = 5

if self.position == '-' and previous_position in '-X+' \
and self.__position['col'] > self.__position['prev_col']:
i = 6

if self.position == '|' and previous_position in '|X+' \
and self.__position['row'] < self.__position['prev_row']:
i = 7

if self.position == '|' and previous_position in '|X+' \
and self.__position['row'] > self.__position['prev_row']:
i = 8

return i

def __test_up(self) -> bool:
row: int = self.__position['row']
col: int = self.__position['col']
Expand Down

0 comments on commit 21fac45

Please sign in to comment.