2424class CodeGame (ABC ):
2525 name : str
2626
27- def __init__ (self , config : dict , * , push_agent : bool = False ):
27+ def __init__ (self , config : dict ):
2828 self .url_gh : str = f"git@github.com:{ GH_ORG } /{ self .name } .git"
2929 self .artifacts : list [Path ] = []
3030 """Artifact objects that we might want to clean up after the game."""
3131 self .scoreboard : list [tuple [int , str ]] = []
3232 """List of (round number, winner (player id))"""
3333 self .game_config : dict = config ["game" ]
3434 self .config : dict = config
35- self .push_agent : bool = push_agent
3635 self .rounds : int = self .game_config .get ("rounds" , 1 )
3736 self .round : int = 0
3837 self .game_id : str = f"{ self .name } { time .strftime ('%y%m%d%H%M%S' )} "
@@ -44,13 +43,6 @@ def __init__(self, config: dict, *, push_agent: bool = False):
4443 self .environment : DockerEnvironment = self .get_environment ()
4544 assert len (config ["players" ]) >= 2 , "At least two players are required"
4645
47- # Initialize agents
48- from codeclash .agents import get_agent
49-
50- self .agents : list [Player ] = []
51- for agent_conf in config ["players" ]:
52- self .agents .append (get_agent (agent_conf , config ["prompts" ], self ))
53-
5446 @property
5547 def image_name (self ) -> str :
5648 return f"codeclash/{ self .name .lower ()} "
@@ -200,21 +192,6 @@ def _post_round_setup(self, agents: list[Player]):
200192 )
201193 self .logger .info (f"Round { self .round } completed." )
202194
203- def run (self , cleanup : bool = False ):
204- """
205- Run the full game with all configured agents.
206- """
207- try :
208- for _ in range (self .rounds ):
209- self .run_round (self .agents )
210- for agent in self .agents :
211- agent .run ()
212- finally :
213- self .end (cleanup )
214- if self .push_agent :
215- for agent in self .agents :
216- agent .push ()
217-
218195 def run_round (self , agents : list [Player ]):
219196 """
220197 Run a single round of the game with the given agents.
0 commit comments