Execute a round of Bridge games.
(self, agents: list[Player])
| 81 | return response["output"] |
| 82 | |
| 83 | def execute_round(self, agents: list[Player]): |
| 84 | """Execute a round of Bridge games.""" |
| 85 | sims = self.game_config.get("sims_per_round", 10) |
| 86 | self.logger.info(f"Running {sims} Bridge simulations with 4 players") |
| 87 | |
| 88 | # Build agent paths for the command |
| 89 | agent_paths = [] |
| 90 | for agent in agents: |
| 91 | agent_paths.append(f"/{agent.name}/{self.submission}") |
| 92 | |
| 93 | # Build base command |
| 94 | cmd = f"{self.run_cmd} {shlex.join(agent_paths)}" |
| 95 | |
| 96 | # Run simulations in parallel |
| 97 | with ThreadPoolExecutor(max_workers=self.game_config.get("sim_concurrency", 8)) as executor: |
| 98 | futures = [ |
| 99 | executor.submit(self._run_single_simulation, agents, idx, f"{cmd} --seed {idx} --dealer {idx % 4}") |
| 100 | for idx in range(sims) |
| 101 | ] |
| 102 | for future in tqdm(as_completed(futures), total=len(futures), desc="Bridge simulations"): |
| 103 | future.result() |
| 104 | |
| 105 | def get_results(self, agents: list[Player], round_num: int, stats: RoundStats): |
| 106 | """Parse results and determine winners.""" |