miroesli / psscscs

Reinforcement Learning Battlesnake
MIT License
2 stars 1 forks source link
ai battlesnake game machine-learning reinforcement-learning

This no longer under development because of outdated/stale code which uses an older version of the battlesnake API. Another version can be viewed here. For other projects like this one see the awesome-battlesnakes repository or check out my profile.

PSSCSCS

A reinforcement learning Battlesnake AI written in Python by a Physics, 2 Software Engineering, and 2 Computer Science undergrads.

Presentation

Demo

7000 Iterations DQN Training

Project specific info

Currently a 3 layer nn is used for prediction. While 8 layers are derived from the input, AlphaGo is not being utilized, need to do this.

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

This AI client uses the bottle web framework to serve requests and the gunicorn web server for running bottle on Heroku. Dependencies are listed in requirements.txt.

Requirements

Running the Snake Locally

  1. Fork (optional) and clone the repo.

Using SSH

git clone git@github.com:miroesli/pssscs.git

Using HTTPS

git clone https://github.com/miroesli/pssscs.git
  1. create the virtualenv
python -m venv env
source env/bin/activate
  1. Install dependencies using pip:
pip install -r requirements.txt
  1. Run local server:
cd app
python main.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:8080/start

Running the Engine

Visit https://github.com/BattlesnakeOfficial/engine for installing the engine to run the AI.

If you have problems running the engine, make sure you have run make install

make install

and built the board

./build_board.sh

If both ./engine dev and engine dev still do not work, build the engine executable locally

go build -o engine cmd/engine/main.go

Then try running ./engine dev

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 http://APP_NAME.herokuapp.com.

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