This is the starting template for the Carleton Computer Science Society's 2025 Battlesnake Hackathon.
Click the button below to create a Replit project from this template:
You will NEED to have a Replit account in order to "remix" the project template.
NOTE: Make sure you are logged into Replit first as you may hit an error if you are not logged in when you click "Remix This App".
Once you open your project in Replit, use the Network Manager to retrieve your Replit URL.
Start by clicking the + (new tab) icon:

Then search for the "Networking":

On the Network Manager, copy your Replit URL:

Once you have your Replit URL, add it to your .env
file.
Start by opening the file explorer by clicking the icon in the top right:

Click on the .env
file in the file explorer and paste your Replit URL as shown:
NOTE: Make sure to hit CTRL+S to save this change. If you do not save this change, your setup will not work.

Once you've configured your Replit URL, you're ready to test your snake.
Start by opening a new tab and opening the Workflow Manager:

Then Click the ./examples
:

To see your snakes battle, click the

NOTE: It may take a moment for the board to pop up in your browser.
If everything is setup correctly, a window should promptly open in your browser with a visualization of your snake.

NOTE: Your browser may try to block the pop up. To allow popups from Replit, click the icons as shown below (Chrome):
Other browsers should have an equivalent.

If you want to run another match, you need to stop then start the "Test Your Snake" workflow:

While your snake is running, you can see the console output of your snake and the 3 test snakes in ./examples
in the console tab:

To start coding your snake, open the main.py
file (this is where your snakes' logic lives):

The most important function is move(game_state)
.
Battlesnake calls this every turn and sends you a JSON payload (game_state
) describing the current board and your snake (an example of that request is shown in the Battlesnake docs.
Your job is to read that data and return one of: "up", "down", "left", or "right".
For example, this code would result in your snake going down every turn.
def move(game_state: typing.Dict) -> typing.Dict:
return {"move": "down"}
When you modify main.py
, make sure you ALWAYS stop, then start your Snake Webserver via the workflow page:

To code with your teammates, have one member of your group send the others a Private Invite Link as shown in the below screenshot:
This will allow you and your teammates to collaboriate on the project alike to how you would in Google Docs.

To be ready for the tournament, make sure your snake has no syntax errors and is left running as shown below:

Having trouble getting your snake running?
Click the arrow next to the Run button, then select Run Environment Health Check.

This will run a script that scans your environment and reports anything that might be missing or misconfigured:
