Spaces:
Running
Running
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
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
|