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

Function read_sim

codeclash/replay/base.py:172–180  ·  view source on GitHub ↗

Read the raw bytes for a game, extracting from its tar archive if needed.

(game: GameRef)

Source from the content-addressed store, hash-verified

170 # Enumerate on collisions, or when the parsed numbers are clearly seeds/timestamps
171 # (e.g. Halite's .hlt names) rather than small sim indices.
172 if len(set(sims)) != len(sims) or (sims and max(sims) > 4 * len(gs) + 100):
173 gs.sort(key=lambda g: g.member or (g.path.name if g.path else ""))
174 for i, g in enumerate(gs):
175 g.sim = i
176 games.sort(key=lambda g: (g.round, g.sim))
177 return games
178
179
180def read_sim(game: GameRef) -> bytes:
181 """Read the raw bytes for a game, extracting from its tar archive if needed."""
182 if game.archive is not None:
183 with tarfile.open(game.archive) as tf:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected