Git Product home page Git Product logo

alphastone's Introduction

Alphastone - Hearthstone Reinforcement Learning AI!

A Hearthstone AI implementation for the fireplace simulator. Uses self-play to train and Monte Carlo Tree Search + Neural Network for decision making. Based off the alphazero algorithm (and its implementation by @suragnair alpha zero general).

Hearthstone is an imperfect information game, meaning that some information is always hidden to both players. This is different from the game of go or chess where your opponent's pieces are visible at all times. As a result, we have to randomize all hidden information (opponent's hand and deck) before every search. MCTS is performed on a set of all the information available to the current player (information set mcts).

The neural network is a small-ish resnet in PyTorch defined in alphanet.py. It is called to evaluate leaf nodes in the search tree and returns a matrix of action probabilities, and the predicted outcome.

References:

  1. AlphaZero: Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm
  2. Information Set Monte Carlo Tree Search
  3. https://hearthstone.gamepedia.com/Hearthstone_Wiki

Experiments

Trained a few different models over the course of 2 weeks but only using basic card set (~150 cards) and priest vs rogue. Best model was trained for around 3 days. It shows decision making and is able to beat a random agent ~80% of the time, but much much more training is needed. (Although it almost beat me once when I had terrible luck)

This is my first large python project and is written by a high school student. I don't have formal coding experience so all help and critique is appreciated!

TO-DO

  • CLEAN-UP CODE! there's a lot of comments and unnecessary bits from debugging
  • Change pit.py to allow for play against trained model
  • Implement ideas in ideas#1

alphastone's People

Contributors

sirmammingtonham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

alphastone's Issues

questions

will overfitting ever be a problem with self-play or would an overfitting neural net always lose to the previous version?

ideas

Embedding vector for all cards with entity_id as index
Create additional policy/dqn for mulligans at start of game

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.