lcipolina commited on
Commit
67608ee
·
verified ·
1 Parent(s): 6af7869

Added parser for multi games

Browse files
src/game_reasoning_arena/configs/config_parser.py CHANGED
@@ -305,20 +305,26 @@ def validate_config(config: Dict[str, Any]) -> None:
305
  Raises:
306
  ValueError: If configuration is invalid
307
  """
308
- # Validate game name
309
- game_name = config.get("env_config", {}).get("game_name")
310
- if not game_name:
311
- raise ValueError("Game name is required in env_config.game_name")
312
-
313
- # Check if game is registered
314
- if game_name not in registry._registry:
315
- available_games = list(registry._registry.keys())
316
- raise ValueError(
317
- f"Game '{game_name}' not found. "
318
- f"Available games: {available_games}"
319
- )
320
-
321
- # Validate agent configurations
 
 
 
 
 
 
322
  agents = config.get("agents", {})
323
  for player_id, agent_config in agents.items():
324
  if "type" not in agent_config:
 
305
  Raises:
306
  ValueError: If configuration is invalid
307
  """
308
+ # Validate single-game config
309
+ if "env_config" in config:
310
+ game_cfgs = [config["env_config"]]
311
+ elif "env_configs" in config:
312
+ game_cfgs = config["env_configs"]
313
+ else:
314
+ raise ValueError("Config must contain either 'env_config' or 'env_configs'")
315
+
316
+ for game_cfg in game_cfgs:
317
+ game_name = game_cfg.get("game_name")
318
+ if not game_name:
319
+ raise ValueError("Game name is required in each game config (game_name)")
320
+ if game_name not in registry._registry:
321
+ available_games = list(registry._registry.keys())
322
+ raise ValueError(
323
+ f"Game '{game_name}' not found. "
324
+ f"Available games: {available_games}"
325
+ )
326
+
327
+ # Validate agent configurations (global, not per-game)
328
  agents = config.get("agents", {})
329
  for player_id, agent_config in agents.items():
330
  if "type" not in agent_config: