22import re
33import subprocess
44import time
5+ from collections import defaultdict
56from concurrent .futures import ThreadPoolExecutor , as_completed
67from pathlib import Path
78
@@ -111,6 +112,7 @@ def execute_round(self, agents: list[Player]):
111112
112113 # Run battle with results output to file
113114 cmd = f"{ self .run_cmd_round } -battle { battle_file } "
115+ self .logger .info (f"Running game: { cmd } " )
114116 with ThreadPoolExecutor (5 ) as executor :
115117 # Submit all simulations to the thread pool
116118 futures = [
@@ -123,6 +125,7 @@ def execute_round(self, agents: list[Player]):
123125 future .result ()
124126
125127 def get_results (self , agents : list [Player ], round_num : int , stats : RoundStats ):
128+ scores = defaultdict (int )
126129 for idx in range (self .game_config .get ("sims_per_round" , 100 ) // SIMS_PER_RUN ):
127130 with open (self .log_round (round_num ) / f"results_{ idx } .txt" ) as f :
128131 result_output = f .read ()
@@ -136,10 +139,7 @@ def get_results(self, agents: list[Player], round_num: int, stats: RoundStats):
136139 match = re .search (r"(\d+)\S+\:\s(\S+)\s+(\d+)" , line )
137140 if match :
138141 player = match .group (2 ).rsplit ("." , 1 )[0 ]
139- score = int (match .group (3 ))
140- if player not in scores :
141- scores [player ] = 0
142- scores [player ] += score
142+ scores [player ] += int (match .group (3 ))
143143
144144 stats .winner = max (scores , key = scores .get )
145145 stats .scores = scores
0 commit comments