@@ -34,6 +34,14 @@ def __init__(self, config: dict, cleanup: bool = False):
3434 def rounds (self ) -> int :
3535 return self .config ["tournament" ]["rounds" ]
3636
37+ def get_metadata (self ) -> dict :
38+ return {
39+ ** super ().get_metadata (),
40+ "scoreboard" : self .scoreboard ,
41+ "game" : self .game .get_metadata (),
42+ "agents" : [self .agent .get_metadata (), self .mirror_agent .get_metadata ()],
43+ }
44+
3745 def get_game_context (self , agent_config : dict , * , round : int ) -> GameContext :
3846 """Create a game context for an agent."""
3947 return GameContext (
@@ -72,7 +80,7 @@ def run(self):
7280 if self .config ["tournament" ]["evaluate_matrix" ]:
7381 self .evaluate ()
7482 finally :
75- self .cleanup ()
83+ self .end ()
7684
7785 def run_training_round (self , round_num : int ) -> None :
7886 """Execute a single training round, i.e., run the game, then run the agent."""
@@ -110,11 +118,11 @@ def set_mirror_state_to_round(self, round_num: int):
110118 full_diff = filter_git_diff (full_diff )
111119 self .mirror_agent .reset_and_apply_patch (full_diff )
112120
113- def cleanup (self ):
121+ def end (self ):
114122 """Clean up game resources."""
115123 self .game .end (self .cleanup_on_end )
116124
117- def evaluate (self , n_repetitions : int = 3 ):
125+ def evaluate (self , n_repetitions : int = 3 ) -> None :
118126 """Evaluate the agent's performance by
119127 calculating the matrix of every round against each other.
120128 """
@@ -150,4 +158,4 @@ def evaluate(self, n_repetitions: int = 3):
150158 )
151159 matrix [p1_round ][p2_round ].append (winner )
152160 self .logger .info (f"Evaluation matrix: { matrix } " )
153- return matrix
161+ self . _metadata . setdefault ( "evaluation" , {})[ "matrix" ] = matrix
0 commit comments