Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Sabatini committed Aug 28, 2024
1 parent 2d2aea9 commit 73bd301
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/domain/mars_rover.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def start(self) -> MarsRoverStarted:
self.status = MarsRoverStatus.STARTED
return MarsRoverStarted.create(self.id)

def turn_right(self) -> MarsRoverMoved | ObstacleHit:
def turn_right(self) -> MarsRoverMoved:
match self.direction:
case Direction.NORTH:
self.direction = Direction.EAST
Expand All @@ -41,7 +41,7 @@ def turn_right(self) -> MarsRoverMoved | ObstacleHit:
self.status = MarsRoverStatus.MOVED
return MarsRoverMoved.create(id=self.id)

def turn_left(self) -> MarsRoverMoved | ObstacleHit:
def turn_left(self) -> MarsRoverMoved:
match self.direction:
case Direction.NORTH:
self.direction = Direction.WEST
Expand Down Expand Up @@ -82,11 +82,11 @@ def move(self) -> MarsRoverMoved | ObstacleHit:
return MarsRoverMoved.create(id=self.id)

def coordinate(self):
hit_obstacles = "O:" if self._is_stopped() else ""
hit_obstacles = "O:" if self._is_obstacle_hit() else ""

return f"{hit_obstacles}{self.actual_point.x}:{self.actual_point.y}:{self.direction.value}"

def _is_stopped(self):
def _is_obstacle_hit(self):
return self.status == MarsRoverStatus.OBSTACLE_HIT

@staticmethod
Expand Down

0 comments on commit 73bd301

Please sign in to comment.