|
14 | 14 | class RobotRumbleGame(CodeGame): |
15 | 15 | name: str = "RobotRumble" |
16 | 16 | 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.""" |
18 | 19 | default_args: dict = {"raw": True} |
19 | 20 | submission: str = "robot.js" |
20 | 21 |
|
@@ -135,7 +136,13 @@ def validate_code(self, agent: Player) -> tuple[bool, str | None]: |
135 | 136 | f"{self.submission} does not contain the required robot function. It should be defined as 'function robot(state, unit) {{ ... }}'.", |
136 | 137 | ) |
137 | 138 | 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 | + ) |
139 | 146 | if "Some errors occurred:" in test_run: |
140 | 147 | return False, f"Running {self.submission} (with `{test_run_cmd}`) resulted in errors:\n{test_run}" |
141 | 148 | return True, None |
0 commit comments