presented by sendwithus, powered by Heroku
BattleSnake is a programming competition held in Victoria BC.
Teams from local schools and tech companies write AI clients for the game BattleSnake.
Last snake standing wins, prizes will be awarded to the most successful teams.
API details and documentation swill be released and discussed the morning of the event.
For more information or to register a team, visit battlesnake.io.
Questions? Email battlesnake@sendwithus.com.
If you weren't paying attention during the introduction, here's what you missed.
- Location and Schedule
- Preparing for Battle
- Prizes and Awards
- Game Rules
- Snake API Documentation
- Example Snakes
- Testing Snakes
- Heroku
- sendwithus
- Dropbox
- VIATeC
- OneNet Marketing
- University of Victoria, Department of Computer Science
- University of Victoria, Technology Integrated Learning
- Women in Engineering and Computer Science (WECS)
- UVic Computer Science Course Union (CSCU)
- UVic Web Development Club
When
February 21st, 11:00am - 8:00pm
Where
University of Victoria, ECS 123 (map)
Schedule
Time | Event |
---|---|
11:00am | Team Registation |
11:30am | Orientation and Game Rules |
12:00pm | Hacking Begins! |
12:30pm | Food |
5:30pm | More Food! |
6:00pm | BattleSnake Tournament Starts |
7:30pm | Drinks @ Felicita's |
Everything you need to know before attending BattleSnake.
Your team will be writing code, come prepared to do so. You should also have the following ready
- Laptop with the following setup:
- Git
- Programming language of choice (Node, Python, Java, etc)
- A text editor (Sublime Text, Vim, etc)
- A GitHub account
- A free Heroku account
For novice and intermediate programmers, we strongly recommend familiarizing yourself with Heroku before hand. Deploying with Heroku will maximize time spent developing your AI (and not messing around with servers). All provided code samples and example AIs will be ready-to-deploy to Heroku.
Also see
- Getting Started on Heroku
- Heroku Toolbelt
- Deploying to Heroku with Git
- Deploying to Heroku with Dropbox
Team registration opens at 11:00am in ECS 123.
To register, you'll need the following:
- Team/Snake Name
- Name of all team members (1-4 suggested)
Individuals may register and compete as a one person team. Anyone looking to join a team will be accommodated.
Orientation will start promptly at 11:30am. Do not be late.
Topics covered during orientaion
- Tournament format and schedule
- Game rules and API documentation
- Sample code for Python, Node, Java, Ruby, and Go
- Where to find help
Orientation will also be the best time to ask questions. Hacking will start immediately afterwards.
$500 Cash, Swag Pack
$300 Cash, Swag Pack
$200, Swag Pack
Heroku Longboard Register Here
1TB Dropbox Space Register Here
Swag Pack Awards
- Hunger Games Snake (most food eaten)
- Predator Snake (most kills)
- Never Surrender Snake (longest)
Tournament starts at 6:00. All snake urls must be submitted by this time. Tournament games will be played on a 15x15 board. There will be 3 rounds total. Rounds will consist of Best of 3 games between up to 6 snakes. Each game awards points as follows:
- 1st: 5 pts
- 2nd: 3 pts
- 3rd: 2 pts
- 4th: 1 pt
- 5-6th: 0 pts
If two snakes die on the same turn, tiebreakers work as follows:
* 1) Longest snake * 2) Most kills * 3) Both snakes receive the lesser # of pts
The x snakes with the highest # of points advance to the next round. If two or more snakes tie for round advancement, a tiebreaker game will be held between the tied snakes. The finals work the same as the previous rounds, except there will be only 4 players, and the round is a best of 5 games.
This is how things work.
BattleSnake is an adaptation of the classic video game "Snake" where you control a snake as it move around the play field. Each round pits up to X snakes against eachother, and the goal is to be the last snake left alive at the end of the round.
- Running into another snake.
- Running into your own body.
- Running into the walls of the play field.
- Head to head collisions result in the death of the shorter snake (or both if tied).
- Your snake starves.
- It's a snake eat snake world out there, and you must eat regularly to survive.
- Your snake starts out with 100 life, and counts down by 1 each turn.
- When your life total reaches 0, your snake dies of starvation.
- To avoid being sacrificed, you must ensure that your snake is well fed.
- Food will spawn randomly around the board.
- Each piece of food eaten will increase the length of your snake by 1, and reset your life to 100.
- Killing another snake by cutting them off with your body will increase the length of your own snake and reset your life to 100.
- Kills increase your length by half of the victims length, rounded down.
- Fuck sportsmanship.
For more information visit battlesnake.io.
- Game clients must exist at a valid HTTP URL capable of responding to the requests specified below.
- Clients must respond to all requests within 2 seconds or face disqualification.
- All requests must return a 200 status code and a valid response body or face disqualification.
Signals the start of a BattleSnake game. All clients must respond with a 200 status code and valid response object or risk being disqualified.
Since game IDs may be re-used, this endpoint may be called multiple times with the same game ID. Clients use this call to reset any saved game state for the given game ID.
- game_id - ID of the game about to start
- width - The width of the game board (the x axis)
- height - The height of the game board (the y axis)
{
"game_id": "hairy-cheese",
"width": 20,
"height": 20
}
- name - friendly name of this snake
- color - display color for this snake (must be CSS compatible)
- head_url (optional) - full URL for a 100x100 snake head image
- taunt (optional) - string message for other snakes
{
"name": "Team Gregio",
"color": "#ff0000",
"head_url": "http://img.server.com/snake_head.png",
"taunt": "Let's rock!"
}
Failing to respond appropriately if invalid response, snake moves forward
- game_id - ID of the game being played
- turn - turn number being played
- board - current board state (see Board State Objects)
- snakes - array of snakes in play (see Snake Objects)
- food - array of food coordinates (see Food Arrays)
{
"game_id": "hairy-cheese",
"turn": 1,
"board": [
[<BoardTile>, <BoardTile>, ...],
[<BoardTile>, <BoardTile>, ...],
...
],
"snakes":[<Snake>, <Snake>, ...],
"food": [[1, 4], [3, 0], [5, 2]]
}
- move - this snakes' next move, one of: ["up", "down", "left", "right"]
- taunt (optional) - string message to other snakes
{
"move": "up",
"taunt": "go snake yourself"
}
Indicates that a specific game has ended. No more move requests will be made. No response required.
- game_id - id of game being ended
{
"game_id": "hairy-cheese"
}
Responses to this endpoint will be ignored.
Describes the state of the board for a specific game. Board State Objects are comprised of a 2-Dimensional array of Board Tiles. This array is indexed to match board coordinates, such that the board tile for coordinates (1, 5) are accessible at board[1][5]. Board coordinates are 0-based with [0][0] representing the top left corner.
[
[<BoardTile>, <BoardTile>, ...],
[<BoardTile>, <BoardTile>, ...],
...
]
- state - one of ["head", "body", "food", "empty"]
- head - occupied by snake head (see snake attribute)
- body - occupied by snake body (see snake attribute)
- food - contains an uneaten piece of food
- empty - an empty tile
- snake (optional) - name of occupying snake (if applicable)
{
"state": "head",
"snake": "Noodlez"
}
Describes the state of a single snake in a particular game.
- name - friendly name of this snake (must be unique)
- state - snake state, one of ["alive", "dead"]
- coords - ordered array of coordinates indicating location of this snake on the board (from head to tail)
- score - current score
- color - display color for this snake
- head_url - full URL to 20x20 snake head image
- taunt - latest string message to other snakes
{
"name": "Noodlez",
"state": "alive",
"coords": [[0, 0], [0, 1], [0, 2], [1, 2]],
"score": 4,
"color": "#ff0000",
"head_url": "http://img.server.com/snake_head.png",
"taunt": "I'm one slippery noodle"
}
An array of coordinate tuples representing food locations.
[
[1, 4], [3, 0], [5, 2]
]
The sendwithus team has provided basic Snake AIs to get you started. Each of these clients can be deployed to Heroku without additional configuration.
Starter Snakes
Example Snakes (that work, but suck)
- Solid BattleSnake - http://battlesnake-dylan.herokuapp.com
- Liam Neeson - http://battlesnake-snaken.herokuapp.com
- Trouser Basilisk - http://battlesnake-will.herokuapp.com
- faroutsnake - http://mattsnake.herokuapp.com/faroutsnake
- Swift Snake - http://battlesnake-jer2.herokuapp.com
- Randosnake - http://battlesnake-rando.herokuapp.com
- Coward Snake - http://battlesnake-coward.herokuapp.com
- tweety-snake - http://mattsnake.herokuapp.com/tweety-snake
- DogeSnake - http://dogesnake.herokuapp.com
- Mention ngrok.
- Mention debug mode.
- Mention papertrail.
We will go over these clarifications partway through the day. If you have any other questions, just ask anyone in sendwithus gear!
FYI! If you start a game with more than one snake sharing the same name, it will glitch and crash the game. We will probably be pushing a fix out for this in a bit, but for now, make sure your snakes all have unique names (we recommend using your team name).
Q: How do I determine the life of my snake!?
A: Once a snake has eaten food or killed another snake, they will return a 'last_eaten' field that gives the last turn they have grown. Once the current turn is 100 greater than the turn they have last eaten, their life will be 0 and the snake will die. If a snake has not yet eaten, this field will not exist on that snake, and should be treated as 0.
Q: Where does my snake start?
A: You will be given the starting coordinates of your snake when the first move is requested. You must identify your own snake by its name. All snakes start with a length of 3, but begin on a single coordinate. The first two turns will grow off of this space, and then the snake will begin to move.
Email battlesnake@sendwithus.com.
For more information or to register a team, visit battlesnake.io.