Giter VIP home page Giter VIP logo

slitherin's Introduction

Single agent and multi agent learning on Slitherin' in OpenAI gym

Train an agent to play Slitherin', either in a single-agent or multi-agent environment. Currently only supports up to 2 snakes.

Usage

Train single player snake:

$ python train_snake.py

Train 2 snakes against each other:

$ python train_snake.py --dual-snakes

Visualize single player agent:

$ python enjoy_snake.py --file saved_model.pkl

Visualize 2 competing agents:

$ python enjoy_snake.py --dual-snakes --file saved_model.pkl

The model in the specified file will be used to control both snakes.

Saving Models

During single-agent training, the final model will be saved to saved_models/trained_model.pkl. In addition, when the agent (approximately) achieves a new highscore, that model will be saved to highscore_model.pkl. This is useful if training is terminated early.

During multi-agent training, opponent models are periodically saved to ./saved_models. This directory can get large, depending on Config.MAX_SAVED_OPPONENTS.

Results

In the single player setting, the agent reaches near optimal performance after ~5k updates (~60 mins on a GTX 1080 Ti and 28 CPUs).

In the multi agent setting, performance is harder to quantify. Comparing scores against a random sample of past opponents, performance appears to converges after ~50k updates (~10 hrs on a GTX 1080 Ti and 28 CPUs), however this performance is suboptimal. Agents develop some resonable attack/defense behaviors, but they also still frequently make avoidable mistakes. Reducing these mistakes is a work in progress.

See ./videos for agent performance.

Notes

This work has so far focused on a relatively small world size, as this makes the agents easier/faster to train.

slitherin's People

Contributors

kcobbe avatar

Stargazers

 avatar

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.