示例#1
0
 def __init__(self, map_path=None, team_size=1, ai_frame_skip=1):
     # Save the map path or use the internal resource
     if map_path:
         self.map_path = map_path
     else:
         self.map_path = file_util.get_resource_path(self.map_resource_name)
     # Save the team size
     self.team_size = team_size
     # Save the frame skip
     self.ai_frame_skip = ai_frame_skip
 def __init__(self, map_path=None, object_size=None, po_radius=np.inf,
              ai_frame_skip=1):
     # Save the map path or use the internal resource
     if map_path:
         self.map_path = map_path
     else:
         self.map_path = file_util.get_resource_path(self.map_resource_name)
     # Save the number of predators, preys and obstacles
     if object_size:
         self.object_size = object_size
     else:
         self.object_size = {
             'PREDATOR': 2,
             'PREY': 2,
             'OBSTACLE': 10,
         }
     # Save the partially observable radius
     self.po_radius = po_radius
     # Save the frame skip
     self.ai_frame_skip = ai_frame_skip
示例#3
0
 def test_get_resource_path(self):
     resource_name = 'pygame_rl/data/map/soccer/soccer.tmx'
     resource_path = file_util.get_resource_path(resource_name)
     assert os.path.normpath(resource_name) in resource_path
示例#4
0
 def _init_map_path(self, map_path):
     if map_path:
         self.map_path = map_path
     else:
         self.map_path = file_util.get_resource_path(self.map_resource_name)
示例#5
0
 def test_read_yaml(self):
     resource_name = 'pygame_rl/data/map/soccer/agent_sprite.yaml'
     resource_path = file_util.get_resource_path(resource_name)
     contents = file_util.read_yaml(resource_path)
     assert len(contents) > 0