MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / __init__

Method __init__

codeclash/analysis/matrix.py:22–59  ·  view source on GitHub ↗
(self, pvp_output_dir: Path, n_repetitions: int = 3, max_workers: int = 4)

Source from the content-addressed store, hash-verified

20
21class PvPMatrixEvaluator:
22 def __init__(self, pvp_output_dir: Path, n_repetitions: int = 3, max_workers: int = 4):
23 self.pvp_output_dir = Path(pvp_output_dir)
24 self.n_repetitions = n_repetitions
25 self.max_workers = max_workers
26 self.metadata = json.loads((self.pvp_output_dir / "metadata.json").read_text())
27
28 assert len(self.players) == 2, f"Expected exactly 2 players, got {len(self.players)}"
29
30 # Set up logging with thread safety
31 self.logger = get_logger("MatrixEvaluator", log_path=self.pvp_output_dir / "matrix_eval.log", emoji="📊")
32 add_root_file_handler(self.pvp_output_dir / "matrix_everything.log")
33
34 # Thread safety for progress saving
35 self._save_lock = Lock()
36
37 # Initialize metadata similar to tournament class
38 self._metadata = {
39 "name": "MatrixEvaluator",
40 "pvp_output_dir": str(self.pvp_output_dir),
41 "p1_name": self.players[0],
42 "p2_name": self.players[1],
43 "rounds": self.rounds,
44 "n_repetitions": n_repetitions,
45 "max_workers": max_workers,
46 "created_timestamp": int(time.time()),
47 "matrices": {},
48 }
49
50 # Load existing progress if available
51 self._load_existing_progress()
52
53 # Initialize game pool and agent pools
54 self._initialize_game_pool()
55 self._initialize_agent_pools()
56
57 self.logger.info(f"Initialized matrix evaluator for {self.players[0]} vs {self.players[1]}")
58 self.logger.info(f"Will evaluate {self.rounds + 1} rounds with {n_repetitions} repetitions each")
59 self.logger.info(f"Using {max_workers} parallel workers")
60
61 # Quick access properties
62 # -----------------------

Callers

nothing calls this directly

Calls 5

_initialize_game_poolMethod · 0.95
get_loggerFunction · 0.90
add_root_file_handlerFunction · 0.90

Tested by

no test coverage detected