def__init__(self,config:dict,environment:DockerEnvironment,game_context:GameContext,push:bool=False,)->None:self.config=configself.name=config["name"]self._player_unique_id=str(uuid.uuid4())"""Unique ID that doesn't clash even across multiple games. Used for git tags."""self.environment=environmentself.game_context=game_contextself.push=pushself.logger=get_logger(self.name,log_path=self.game_context.log_local/"players"/self.name/"player.log",emoji="👤",)self._metadata={"name":self.name,"player_unique_id":self._player_unique_id,"created_timestamp":int(time.time()),"config":self.config,"initial_commit_hash":self._get_commit_hash(),"branch_name":self._branch_name,"round_tags":{},# mapping round -> tag"agent_stats":{},# mapping round -> agent stats}ifbranch:=config.get("branch_init"):self.logger.info(f"Checking out branch {branch}")assert_zero_exit_code(self.environment.execute(f"git checkout {branch}"),logger=self.logger)ifself.push:self.logger.info("Will push agent gameplay as branch to remote repository after each round")token=os.getenv("GITHUB_TOKEN")ifnottoken:raiseValueError("GITHUB_TOKEN environment variable is required")forcmdin["git remote remove origin",f"git remote add origin https://x-access-token:{token}@github.com/{GH_ORG}/{self.game_context.name}.git",]:assert_zero_exit_code(self.environment.execute(cmd),logger=self.logger)