Skip to content

Commit d2a128d

Browse files
committed
Minor corewar fix
1 parent 937b4f0 commit d2a128d

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

.env.example

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,3 @@ OPENAI_API_KEY=
1111
GEMINI_API_KEY=
1212
XAI_API_KEY=
1313
DASHSCOPE_API_KEY=
14-
15-
# Optional: only needed for legacy configs that still set `model_class: portkey`.
16-
PORTKEY_API_KEY=

codeclash/arenas/corewar/corewar.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ def get_results(self, agents: list[Player], round_num: int, stats: RoundStats):
9797
def validate_code(self, agent: Player) -> tuple[bool, str | None]:
9898
if self.submission not in agent.environment.execute("ls")["output"]:
9999
return False, f"There should be a `{self.submission}` file"
100-
# Play game against a simple default bot to ensure it runs
101-
test_run_cmd = f"{self.run_cmd_round} {self.submission} /home/dwarf.red"
100+
# Play game against a simple default bot to ensure it runs. Pass -r with the real
101+
# round count so warriors that `;assert ROUNDS > 1` (a common idiom) validate the same
102+
# way they'll actually run, instead of failing on pmars's default single round.
103+
test_run_cmd = f"{self.run_cmd_round} {self.submission} /home/dwarf.red -r {self.game_config['sims_per_round']}"
102104
test_run = agent.environment.execute(test_run_cmd, timeout=60)["output"]
103105
if any([l.startswith("Error") for l in test_run.split("\n")]):
104106
return False, f"The `{self.submission}` file is malformed (Ran `{test_run_cmd}`):\n{test_run}"

0 commit comments

Comments
 (0)