Skip to content

Commit 53f7223

Browse files
committed
Update timeout
1 parent c4b391b commit 53f7223

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,5 @@ __marimo__/
217217

218218

219219
# >>>>>>>>> CUSTOM THINGS ON TOP OF FILE <<<<<<<<<
220+
assets/*.json
221+
assets/*.png

codeclash/games/robotrumble/robotrumble.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
class RobotRumbleGame(CodeGame):
1515
name: str = "RobotRumble"
1616
description: str = """RobotRumble is a turn-based coding battle where you program a team of robots in Python to move, attack, and outmaneuver your opponent on a grid.
17-
Every decision is driven by your code, and victory comes from crafting logic that positions robots smartly, times attacks well, and adapts over the 100-turn match."""
17+
Every decision is driven by your code, and victory comes from crafting logic that positions robots smartly, times attacks well, and adapts over the 100-turn match.
18+
NOTE: Please ensure that your code runs efficiently (under 60 seconds). Code that exceeds this run time will automatically forfeit the round."""
1819
default_args: dict = {"raw": True}
1920
submission: str = "robot.js"
2021

@@ -135,7 +136,13 @@ def validate_code(self, agent: Player) -> tuple[bool, str | None]:
135136
f"{self.submission} does not contain the required robot function. It should be defined as 'function robot(state, unit) {{ ... }}'.",
136137
)
137138
test_run_cmd = f"{self.run_cmd_round} {self.submission} {self.submission} -t 1"
138-
test_run = agent.environment.execute(test_run_cmd)["output"]
139+
try:
140+
test_run = agent.environment.execute(test_run_cmd, timeout=60)["output"]
141+
except subprocess.TimeoutExpired:
142+
return (
143+
False,
144+
f"Running {self.submission} (with `{test_run_cmd}`) timed out (60 seconds). Please ensure your code runs efficiently.",
145+
)
139146
if "Some errors occurred:" in test_run:
140147
return False, f"Running {self.submission} (with `{test_run_cmd}`) resulted in errors:\n{test_run}"
141148
return True, None

0 commit comments

Comments
 (0)