Exemplo n.º 1
0
    def game(self):
        """Get the game object, will initilized this afterward"""
        if self._game is None:
            raise exceptions.NotInitalizedException(
                "Game haven't been initilized")

        return self._game
Exemplo n.º 2
0
    def _west(self):
        """
        Move the player to the west direction.
        """
        if self._game is None:
            raise exceptions.NotInitalizedException(
                "Game haven't been initilized")

        # Get the next location after moving to the north.
        self.location = self.game.move_west(self.location)
Exemplo n.º 3
0
    def location(self):
        """
        Get the location of the player.
        Noted that it will in initilized when create the map

        Return
            1. location (2 elements tuple) - the location of the player.
        """
        if self._location is None:
            raise exceptions.NotInitalizedException("Location haven't been initilized")
        
        return self._location
Exemplo n.º 4
0
 def size(self):
     """Getter method for the size"""
     if self._size is None:
         raise exceptions.NotInitalizedException("The size isn't initilized.")
     return self._size