Skip to content

jonpavelich/battlesnake-python3-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

battlesnake-python3-starter

A Battlesnake starter written in Python 3 and Flask.

Visit https://github.com/battlesnakeio/community/blob/master/starter-snakes.md for API documentation and instructions for running your AI.

This AI client uses Flask to serve requests and the gunicorn web server to run on Heroku. Dependencies are listed in requirements.txt.

You will need...

Building a Snake

Write your snake code in src/snake.py

Running the Snake Locally

  1. Fork this repo.

  2. Clone repo to your development environment:

git clone [email protected]:<your github username>/battlesnake-python3-starter.git
  1. Set up a virtual environment using virtualenv
# Use the default Python on your path:
virtualenv venv

# Or use a specific path:
virtualenv -p /path/to/python3 venv
  1. Activate the virtual environment (you have to do this every time you open a new shell)
# Linux, macOS
source venv/bin/activate

# Windows
venv/Scripts/activate.bat
  1. Install dependencies using pip:
pip install -r requirements.txt
  1. Run local server:
cd src
python app.py
  1. Test your snake by sending a curl to the running snake
curl -XPOST -H 'Content-Type: application/json' -d '{ "hello": "world"}' http://localhost:5000/start

Deploying to Heroku

  1. Create a new Heroku app:
heroku create [APP_NAME]
  1. Deploy code to Heroku servers:
git push heroku master
  1. Open Heroku app in browser:
heroku open

or visit https://APP_NAME.herokuapp.com.

  1. View server logs with the heroku logs command:
heroku logs --tail

License

This code is licensed under the MIT License. See LICENSE.

Credit

Written by Jon Pavelich and Tyler Harnadek for BattleSnake 2019. This README file is based on the battlesnakeio/starter-snake-python README.

About

Starter snake written in Python 3 for BattleSnake (https://battlesnake.io)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages