This template provides a few key files to get you started. Here's what each one does:
This is the most important file. This is your starter code, where you will write your agent's logic.
- DO NOT RENAME THIS FILE! Our pipeline will only recognize your agent as
agent.py. - It contains a fully functional, Flask-based web server that is already compatible with the Judge Engine's API.
- It has all the required endpoints (
/,/send-state,/send-move,/end). You do not need to change the structure of these. - Look for the
send_movefunction. Inside, you will find a section marked with comments:# --- YOUR CODE GOES HERE ---. This is where you should add your code to decide which move to make based on the current game state. - Your agent can return moves in the format
"DIRECTION"(e.g.,"UP","DOWN","LEFT","RIGHT") or"DIRECTION:BOOST"(e.g.,"UP:BOOST") to use a speed boost.
This file lists your agent's Python dependencies.
- Don't rename this file either.
- It comes pre-populated with
Flask,gunicorn, andrequests. - If your agent's logic requires other libraries (like
numpy,scipy, or any other package from PyPI), you must add them to this file. - When you submit, our build pipeline will run
pip install -r requirements.txtto install these libraries for your agent.
A copy of the runner of matches.
- The judge engine is the heart of a match in Case Closed. It can be used to simulate a match.
- The judge engine can be run only when two agents are running on ports
5008and5009. - We provide a sample agent that can be used to train your agent and evaluate its performance.
A copy of the official game state logic.
- This file contains the complete state of the match played, including the
Game,GameBoard, andAgentclasses. - While your agent will receive the game state as a JSON object, you can read this file to understand the exact mechanics of the game: how collisions are detected, how trails work, how boosts function, and what ends a match. This is the "source of truth" for the game rules.
- Key mechanics:
- Agents leave permanent trails behind them
- Hitting any trail (including your own) causes death
- Head-on collisions: the agent with the longer trail survives
- Each agent has 3 speed boosts (moves twice instead of once)
- The board has torus (wraparound) topology
- Game ends after 200 turns or when one/both agents die
A simple agent that you can play against.
- The sample agent is provided to help you evaluate your own agent's performance.
- In conjunction with
judge_engine.py, you should be able to simulate a match against this agent.
A local tester to verify your agent's API compliance.
- This script tests whether your agent correctly implements all required endpoints.
- Run this to ensure your agent can communicate with the judge engine before submitting.
A copy of the Dockerfile your agent will be containerized with.
- This is a copy of a Dockerfile. This same Dockerfile will be used to containerize your agent so we can run it on our evaluation platform.
- It is HIGHLY recommended that you try Dockerizing your agent once you're done. We can't run your agent if it can't be containerized.
- There are a lot of resources at your disposal to help you with this. We recommend you recruit a teammate that doesn't run Windows for this.
- A standard configuration file that tells Git which files and folders (like the
venvvirtual environment directory) to ignore. You shouldn't need to change this.
Both agent.py and sample_agent.py come ready to run out of the box!
- To test your agent, you will likely need to create a
venv. Look up how to do this. - Next, you'll need to
pip installany required libraries.Flaskis one of these. - Finally, in separate terminals, run both
agent.pyandsample_agent.py, and only then can you runjudge_engine.py. - You can also run
local-tester.pyto verify your agent's API compliance before testing against another agent.
- There is a 4GB limit on Docker image size, to keep competition fair.
- If your agent's logic extends beyond the scope of
agent.pyandrequirements.txt, our pipeline will not include that external logic. You will be responsible for Dockerizing your agent manually in this case. - Ensure your agent's
requirements.txtis complete before pushing changes. - If you run into any issues, take a look at your own agent first before asking for help.