GithubHelp home page GithubHelp logo

miroesli / psscscs Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 21.45 MB

Reinforcement Learning Battlesnake

License: MIT License

Python 100.00%
ai battlesnake game machine-learning reinforcement-learning

psscscs's Introduction

~$ whoami

Hi there ๐Ÿ‘‹,

My name is Michail Roesli and my dream is to provide a meaningful difference to the world through data analytics and machine learning.

๐Ÿ‘ฆ About Me

  • ๐Ÿซ Graduated from the University of Victoria with a focus in Computational Intelligence
  • ๐Ÿ’ป Learning Rust and Julia on the side
  • ๐Ÿ”ญ Always on the lookout to learn new things and explore new passion projects
  • ๐Ÿง I love Linux and open source projects โค๏ธ

๐Ÿ”— Contact

psscscs's People

Contributors

ahmednsidd avatar alexophile avatar brandonb927 avatar bvanvugt avatar cdfriend avatar chris-bsnake avatar codeallthethingz avatar dependabot[bot] avatar fool-yang avatar gschier avatar john-swu avatar joram avatar krocodial avatar miroesli avatar sean-lynch avatar swapnil-dx avatar synthesizedsoul avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dachenscratch

psscscs's Issues

Fix Heroku build requirements package error

       ERROR: tensorboard 1.14.0 has requirement setuptools>=41.0.0, but you'll have setuptools 39.0.1 which is incompatible.

       Installing collected packages: bottle, greenlet, gevent, gunicorn, six, numpy, scipy, keras-preprocessing, h5py, keras-applications, pyyaml, keras, keras-rl, astor, termcolor, wrapt, gast, google-pasta, protobuf, absl-py, grpcio, werkzeug, markdown, tensorboard, tensorflow-estimator, tensorflow

Heroku deployment

If we can run this on a lightweight platform like heroku I think it'd be ideal. See if we can stand this up on Heroku and how it performs

Help me to run the test

for it is easy for a human to read,
I have switched on the state printing in game.py
run this file with command python run_this_test_and_output_to_a_file.py > output.txt
see if the results make sense
a 1-8 number represents a snake body, with value = its id
9 represents a food
feel free to make your own test

you won't be able to see dead snakes' bodies or how it died. In other words, they just disappear one turn before they make the stupid move.

Rewards for DQN

Rewards functionality in the gym
Look in the env/ folder
Instantiate a new class in there
If you win, add one score, if you lose deduct one score

Create MCTS

Create a monte carlo tree search for AlphaZero algorithm

Change The Compete and Train_Alpha Functions in AlphaZero Algorithm to Be An Instance Method

In app/algs/neuralnet.py, the compete() and train_alpha() methods should be changed so that they are instance methods. This includes changing the first function parameter to be "self". Simple hotfix required. Additionally, this change needs to be refactored throughout the same file, so that when we're calling the compete and train_alpha functions, we're calling it using self.function_name(params).

Store trained neural net in app/train.py in app/models/

In this issue, we need to store our trained, amazing neural network to disk in the app/models/ folder so we can actually use it later on. Everything to do this is more or less already set in place. When we run the train function for our alg, we'll get returned back a AlphaNNet object. These objects already have an instance function called save. The only thing that I think will need to be changed is the save function will need to specify the models folder. So the function will need to be changed from self.nnet.save(name + '.h5') to self.nnet.save('./models/' + name + '.h5') although not a 100% sure about this. Verification is left to the assignee.

Add alg loader

This will replace how train calls the algorithms and how main initializes on deployment.

It will be imported from utils

Big update. I rewrote the battlesnake game!!!

The game.py (which uses snake.py) is a battlesnake game that can be run totally locally, so we can start training on our machines without having to deal with browsers and web-based interfaces. It also uses optimized data structures so it runs much faster (at least in theory; they use the language "go" so I don't know how that is compared to python). I also added a translator to convert the online data to our new data.

Allow real-world training

It might be beneficial to be able to pit our snake against others by including training functionality in our API

Do some preprocessing for DQN algorithm

This may include:

  • Change input state for DQN algorithm to be similar to how Yung modified the input state so we can see snake length, snake direction etc.

Latest update notes and what we should do next

  1. a bat script is added to the root dir along with the game engine. If you uses windows, then double click the .bat file will run my snake locally and open the browser.

  2. two new folders added in the app folder. algorithms and models

  3. TEMP.py renamed to preprocess and is now in the algorithms folder

Fix Relative Import Issue

Problem with main.py where running main.py results in an error because we were using relative importing because the linter was complaining.

Fix trainer selector

Change the train selection to choose the one specified by the input JSON, otherwise it should choose template. It should not ever create template trainer before selecting another one.

see lines 49 to 51 in train.py.

Essentially, change this to what it was before.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.