Skip to content

Commit ac1b506

Browse files
committed
Also copy round stats to metadata
Closes #54
1 parent a8eea25 commit ac1b506

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

codeclash/tournaments/pvp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ def run_competition_phase(self, round_num: int) -> None:
8383
stats = self.game.run_round(self.agents, round_num)
8484
self.logger.info(stats)
8585

86+
self._metadata.setdefault("round_stats", {})[round_num] = stats.to_dict()
87+
8688
# Create directory for round logs
8789
(self.game.log_local / "rounds" / str(round_num)).mkdir(parents=True, exist_ok=True)
8890

codeclash/tournaments/single_player.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def run_training_round(self, round_num: int) -> None:
9595
# Run the game round and get results
9696
stats = self.game.run_round([self.agent, self.mirror_agent], round_num)
9797
self.logger.info(stats)
98+
self._metadata.setdefault("round_stats", {})[round_num] = stats.to_dict()
9899

99100
# Write log to file
100101
results_file = self.game.log_local / "rounds" / str(round_num) / FILE_RESULTS

0 commit comments

Comments
 (0)