Skip to content

Commit b5fa030

Browse files
john-b-yangclaude
andcommitted
Reject BattleSnake submissions missing a server entrypoint
validate_code was a pure function-def check, so a main.py that drops the 'if __name__ == "__main__": run_server(...)' block passed validation but failed to start at runtime (forfeit). Require the entrypoint statically. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 16d9ef3 commit b5fa030

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

codeclash/arenas/battlesnake/battlesnake.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,11 @@ def validate_code(self, agent: Player) -> tuple[bool, str | None]:
203203
error_msg.append(f"There should be a `{func}` function implemented in `{self.submission}`")
204204
if len(error_msg) > 0:
205205
return False, "\n".join(error_msg + ["Don't change the function signatures!"])
206+
207+
# `python main.py` boots the server via the __main__ entrypoint.
208+
if "__main__" not in bot_content or "run_server" not in bot_content:
209+
return False, (
210+
f"`{self.submission}` must keep its server entrypoint so the bot starts: the "
211+
'`if __name__ == "__main__": run_server(...)` block at the bottom of the file.'
212+
)
206213
return True, None

0 commit comments

Comments
 (0)