Skip to content

tamu-datathon-org/monkey-sample-agent

Repository files navigation

Case Closed Agent Template

Explanation of Files

This template provides a few key files to get you started. Here's what each one does:

agent.py

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_move function. 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.

requirements.txt

This file lists your agent's Python dependencies.

  • Don't rename this file either.
  • It comes pre-populated with Flask, gunicorn, and requests.
  • 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.txt to install these libraries for your agent.

judge_engine.py

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 5008 and 5009.
  • We provide a sample agent that can be used to train your agent and evaluate its performance.

case_closed_game.py

A copy of the official game state logic.

  • This file contains the complete state of the match played, including the Game, GameBoard, and Agent classes.
  • 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

sample_agent.py

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.

local-tester.py

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.

Dockerfile

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.

.gitignore

  • A standard configuration file that tells Git which files and folders (like the venv virtual environment directory) to ignore. You shouldn't need to change this.

Testing your agent:

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 install any required libraries. Flask is one of these.
  • Finally, in separate terminals, run both agent.py and sample_agent.py, and only then can you run judge_engine.py.
  • You can also run local-tester.py to verify your agent's API compliance before testing against another agent.

Disclaimers:

  • There is a 4GB limit on Docker image size, to keep competition fair.
  • If your agent's logic extends beyond the scope of agent.py and requirements.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.txt is complete before pushing changes.
  • If you run into any issues, take a look at your own agent first before asking for help.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published