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

Function scores_to_ranks

codeclash/analysis/metrics/tskill.py:34–47  ·  view source on GitHub ↗

Higher score => better rank (0 is best). Ties share the same rank.

(scores_dict)

Source from the content-addressed store, hash-verified

32
33
34def scores_to_ranks(scores_dict):
35 """Higher score => better rank (0 is best). Ties share the same rank."""
36 # Sort by (-score, name) for deterministic ordering
37 ordered = sorted(scores_dict.items(), key=lambda kv: (-kv[1], kv[0]))
38 ranks = {}
39 prev_score, prev_rank = None, None
40 for idx, (name, score) in enumerate(ordered):
41 if score == prev_score:
42 ranks[name] = prev_rank
43 else:
44 ranks[name] = idx
45 prev_rank = idx
46 prev_score = score
47 return ordered, ranks # ordered is list[(name, score)] in finishing order
48
49
50def update_ratings_for_round(scores_dict):

Callers 1

update_ratings_for_roundFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected