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

Function compute_win_rates

codeclash/analysis/transparent/main.py:12–29  ·  view source on GitHub ↗
(folder_list)

Source from the content-addressed store, hash-verified

10
11
12def compute_win_rates(folder_list):
13 wins = defaultdict(int)
14 total = defaultdict(int)
15
16 for folder in folder_list:
17 metadata = json.load(open(folder / "metadata.json"))
18
19 # Count wins per round
20 for round_key, round_data in metadata["round_stats"].items():
21 if round_key == "overall":
22 continue
23 winner = round_data.get("winner")
24 for player in round_data.get("scores", {}).keys():
25 total[player] += 1
26 if player == winner:
27 wins[player] += 1
28
29 return {player: wins[player] / total[player] if total[player] > 0 else 0 for player in total.keys()}
30
31
32def analyze_opponent_code_access(folder_list):

Callers 1

main.pyFile · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected