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

Function get_scores

codeclash/analysis/metrics/elo.py:1236–1263  ·  view source on GitHub ↗
(stats: dict)

Source from the content-addressed store, hash-verified

1234
1235 # Add reference line at ELO_BASE
1236 ax.axhline(ELO_BASE, color="red", linestyle="--", alpha=0.5, linewidth=1, label=f"Base Elo ({ELO_BASE})")
1237
1238 legend = ax.legend(prop=FONT_BOLD, fontsize=12, loc="best")
1239 legend.set_frame_on(False)
1240
1241 plt.tight_layout()
1242 safe_game_name = game_name.replace("/", "_").replace(" ", "_")
1243 self._save_plot(output_dir, f"{safe_game_name}_elo_only_at_round")
1244 plt.close()
1245
1246
1247def get_scores(stats: dict) -> dict[str, float]:
1248 valid_submits = sum(
1249 [x["valid_submit"] for x in stats["player_stats"].values() if x.get("valid_submit") is not None]
1250 )
1251
1252 ties = stats["scores"].get(RESULT_TIE, 0)
1253 sims = sum(stats["scores"].values())
1254 assert sims >= ties
1255
1256 player2score = {}
1257 for k, v in stats["player_stats"].items():
1258 if k != RESULT_TIE:
1259 if v["score"] is None:
1260 # Not sure why this happens, but just skip it
1261 # Kilian: This is probably when we skip a round (might have fixed this, but probably in old logs)
1262 continue
1263 if valid_submits == 1:
1264 # FOR BACKWARDS COMPATIBILITY: If only one player submitted, give them full point
1265 if v["valid_submit"]:
1266 _score = 1.0

Callers 3

extract_round_scoresFunction · 0.90
_get_round_scoreMethod · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected