コード例 #1
0
ファイル: player.py プロジェクト: Phu-archive/GridWorld
    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
コード例 #2
0
ファイル: player.py プロジェクト: Phu-archive/GridWorld
    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)
コード例 #3
0
ファイル: prefab.py プロジェクト: Phu-archive/GridWorld
    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
コード例 #4
0
ファイル: prefab.py プロジェクト: Phu-archive/GridWorld
 def size(self):
     """Getter method for the size"""
     if self._size is None:
         raise exceptions.NotInitalizedException("The size isn't initilized.")
     return self._size