Skip to content

Commit 34d64f5

Browse files
committed
Fix Ants PR CI: ruff import order + format, and single-player commit_label default
- Sort AntsArena import (ruff isort) and reformat replay.py (ruff format) - single_player: default commit_label to '' (fixes test_single_player_battlesnake KeyError)
1 parent 7890944 commit 34d64f5

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

codeclash/arenas/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from codeclash.arenas.arena import CodeArena
21
from codeclash.arenas.ants.ants import AntsArena
2+
from codeclash.arenas.arena import CodeArena
33
from codeclash.arenas.battlecode23.battlecode23 import BattleCode23Arena
44
from codeclash.arenas.battlecode24.battlecode24 import BattleCode24Arena
55
from codeclash.arenas.battlecode25.battlecode25 import BattleCode25Arena

codeclash/arenas/ants/replay.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@ def parse(self, raw: bytes, players: list[dict] | None = None) -> ReplayData:
120120
names.append(f"player{len(names) + 1}")
121121

122122
frames = [
123-
{"turn": fr.get("t", idx), "ants": fr.get("ants", []), "hills": fr.get("hills", []), "food": fr.get("food", [])}
123+
{
124+
"turn": fr.get("t", idx),
125+
"ants": fr.get("ants", []),
126+
"hills": fr.get("hills", []),
127+
"food": fr.get("food", []),
128+
}
124129
for idx, fr in enumerate(log.get("frames", []))
125130
]
126131

codeclash/tournaments/single_player.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ def get_game_context(self, agent_config: dict, *, round: int) -> GameContext:
6262

6363
def get_agent(self, agent_config: dict, round: int) -> Player:
6464
"""Create an agent with environment and game context."""
65+
# Commit/tag messages are prefixed with `commit_label` (see Player._round_message);
66+
# single-player has no rung/opponent prefix, so default it to empty (as PvP does).
67+
agent_config.setdefault("commit_label", "")
6568
environment = self.game.get_environment(f"{self.game.game_id}.{agent_config['name']}")
6669
game_context = self.get_game_context(agent_config, round=round)
6770
return get_agent(agent_config, game_context, environment)

0 commit comments

Comments
 (0)