Battlesnake AI for play.battlesnake.io written in python.
Visit https://github.com/battlesnakeio/community/blob/master/starter-snakes.md for API documentation and instructions for running AI.
This AI client uses the bottle web framework to serve requests and the gunicorn web server for running bottle on Heroku (if deployed there). Dependencies are listed in requirements.txt.
- a working Python 2.7 development environment (getting started guide)
- pip to install Python dependencies
- Clone repo to your development environment:
Using SSH
git clone git@github.com:mroesli/pyke-snake.git
Using HTTPS
git clone https://github.com/mroesli/pyke-snake.git
- Change your directory to pyke-snake:
cd pyke-snake
- Install dependencies using pip:
pip install -r requirements.txt
- Run local server for snake:
python app/main.py
- After doing the previous step, we will have a snake running on http://localhost:8080 (Check the link for API documentation). We can test if our snake is running by opening up another terminal, and sending a curl to the running snake:
curl -XPOST -H 'Content-Type: application/json' -d '{ "hello": "world"}' http://localhost:8080/start
- To terminate the snake, go to the terminal running the snake, and stop the process using the following command:
Ctrl+C
- Assuming snake is already running locally, open up another terminal.
- Open up pyke-snake and change your directory to the engine:
cd engine
- Run the engine using the following:
./engine dev
- Open up the engine in any browser through this link: http://localhost:3010.
- You will be presented with a screen to configure the board and also input the link to the running snake.
- If you followed the previous steps, the snake should be running on https://localhost:8080. Use this as the "Snake URL" and name the snake with whatever name you want.
- Add as many snakes as possible with known URL's to the game as you want.
- Click "Start".
- You should now be able to simulate a game by clicking "play". Have fun!