Ejemplo n.º 1
0
class Rover(object):
    """rover class"""
    def __init__(self):
        """default constructor of rover"""
        self.position = Location(0, 0)
        self.direction = Orientation("E")
    def __init__(self, loc, orient):
        """parameterised constructor of rover class"""
        self.position = loc
        self.direction = orient
    def turn(self, side):
        """fuction to handle turn command"""
        points_to = self.direction.get_direction()
        self.direction.set_direction(Navigation.rule1[points_to][side])
    def move(self):
        """function to handle move command"""
        Navigation.move1(self.position, self.direction)
    def return_status(self):
        """function that returns current status of the rover"""
        return [self.position.get_loc(), self.direction.get_direction()]
Ejemplo n.º 2
0
 def __init__(self):
     """default constructor of rover"""
     self.position = Location(0, 0)
     self.direction = Orientation("E")