What is Battlesnake?

A Battlesnake is a programmed web server that implements the Battlesnake HTTP API to play the game snake against other Battlesnakes. When a game is running, the Battlesnake Game Engine will make HTTP requests to your server, sending you game information and asking for your next move.

Step 1 - Build Your Snake

Select a technology you want to use to program your snake. Anything that can process a web request and be deployed to the internet will work. There are several Starter Snakes that can be used as a base if you don't want to start from scratch. Each is built with a popular programming language and web application framework.

Your Battlesnake must support 4 endpoints that will be called by the Game Engine:

/ping

The engine is asking your snake if it is alive

/start

Notifies your snake that it is participating in a new game

/move

Updates your snake with the current state of the game board and asks for a move

/end

Notifies your snake that the game is over.

Each endpoint will be sent a JSON data blob by the Game Engine and your server must respond with a 200 status code and an appropriate JSON response. The protocol for these requests and responses are defined in detail in the Battlesnake API docs.

Step 2 - Deploy Your Snake

Before your snake can do battle, it must be deployed to a publicly accessible server. This can be done using a cloud hosting provider such as Heroku or Amazon Web Services. Many of these services provide a free tier for deploying web servers.

Many of the Starter Snakes have instructions on how to deploy the snakes to a public Heroku instance so you can get started quickly.

Step 3 - Register Your Snake

Once your snake is operational, it needs to be registered on the Battlesnake website. Click on the button below to setup a new snake.

Create A Snake

Step 4 - Battle With Your Snake

You are now ready to test your snake against others in live games.

  1. Go to your snake's profile page on the Battlesnake website
  2. Click on the Play Game button. You will see a form with your snake preselected.
  3. Use the Add a Random Snake button to add a challenger
  4. Click on Create Game button to start the game

You will be rewarded with a view of the board that includes your snake and the challenger. Click on the Play button at the bottom of the board to start the match and see who wins!

See something that could be improved?
View the source and submit a pull request on GitHub.

© 2020 Battlesnake Inc. and contributors. Battlesnake is a registered trademark of Battlesnake Inc.