Skip to content

Commit 32aa298

Browse files
committed
BattleCode working
1 parent cfed8f7 commit 32aa298

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

codeclash/games/abstract.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ def run_round(self, agents: list[Any]):
140140
self._pre_round_setup(agents)
141141
self.execute_round(agents)
142142
self.determine_winner(agents)
143+
last_winner = self.scoreboard[-1][1]
144+
print(f"Round {self.round} winner: {last_winner}")
143145
self._post_round_setup(agents)
144146

145147
@property

codeclash/games/battlecode/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
22
from typing import Any
33

4-
from codeclash.constants import RESULT_TIE
4+
from codeclash.constants import DIR_WORK, RESULT_TIE
55
from codeclash.games.abstract import CodeGame
66

77

@@ -26,8 +26,13 @@ def determine_winner(self, agents: list[Any]):
2626
self.scoreboard.append((self.round, winner))
2727

2828
def execute_round(self, agents: list[Any]):
29+
for agent in agents:
30+
src, dest = f"/{agent.name}/src/mysubmission/", str(
31+
DIR_WORK / "src" / agent.name
32+
)
33+
self.environment.execute(f"cp -r {src} {dest}")
2934
args = [
30-
f" --p{idx+1}-dir /{agent.name}/src/ --p{idx+1} {agent.name}"
35+
f"--p{idx+1}-dir src --p{idx+1} {agent.name}"
3136
for idx, agent in enumerate(agents)
3237
]
3338
cmd = f"{self.run_cmd_round} {' '.join(args)} > {self.round_log_path}"

0 commit comments

Comments
 (0)