miroesli / pyke-snake

Battlesnake AI for play.battlesnake.io :snake:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pyke snake

Maintainability

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.

Prerequisites

Running the Snake Locally

  1. 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
  1. Change your directory to pyke-snake:
cd pyke-snake
  1. Install dependencies using pip:
pip install -r requirements.txt
  1. Run local server for snake:
python app/main.py
  1. 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
  1. To terminate the snake, go to the terminal running the snake, and stop the process using the following command:
Ctrl+C

Running the engine

  1. Assuming snake is already running locally, open up another terminal.
  2. Open up pyke-snake and change your directory to the engine:
cd engine
  1. Run the engine using the following:
./engine dev
  1. Open up the engine in any browser through this link: http://localhost:3010.
  2. You will be presented with a screen to configure the board and also input the link to the running snake.
  3. 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.
  4. Add as many snakes as possible with known URL's to the game as you want.
  5. Click "Start".
  6. You should now be able to simulate a game by clicking "play". Have fun!

About

Battlesnake AI for play.battlesnake.io :snake:

License:MIT License


Languages

Language:HTML 31.7%Language:CSS 27.2%Language:JavaScript 21.4%Language:Python 19.8%