Git Product home page Git Product logo

rdecka / 0xai Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 993 KB

Code for my bachelor thesis "Using Monte Carlo tree search and machine learning to learn a heuristic function"

License: BSD 2-Clause "Simplified" License

Go 70.06% JavaScript 9.01% HTML 2.43% CSS 1.48% Python 14.79% Makefile 2.23%
bachelor-thesis hex-game hex monte-carlo-tree-search alpha-beta-pruning minimax-algorithm linear-regression machine-learning

0xai's Introduction

0xAI

Code for my bachelor thesis Using Monte Carlo tree search and machine learning to learn a heuristic function.

The thesis with the description of the project (in Slovene) is available on http://eprints.fri.uni-lj.si/4337/.

Brief description

Minimax algorithm is one of the most widely used algorithms for playing two-player games. It uses a heuristic function that estimates the benefits of reaching a given game state for both players. We attemp to automatically create that kind of a function for the game of Hex. Different models of supervised machine learning are trained on learning samples, generated by simulations of MCTS.

How to run the code

The easiest way is to use the provided Makefile.

  1. If you want, you can change some values in Makefile, for example:
    • SIZE - the size of the Hex grid
    • TIME - how much time can a single MCTS run (in seconds)
    • WORKERS - how many goroutines should be created to run MCTS in parallel
    • THRESHOLD_N - how many times should a node of MCTS tree be visited to be used as a learning sample.
  2. Run make in the root directory.
  3. MCTS will start generating learning samples in folder data/SIZE/mcts/run-START_TIME/. When you are satisfied with the number of samples, type q and press Enter.
  4. ML phase will start and generate code with evaluation functions. Just wait.
  5. Code for the server will be compiled. Follow the instructions on the screen to run it.
  6. Open localhost:8080/select/ and play! Or just watch.

It is possible to run only specific parts of the project.

  • make mcts will run only MCTS phase.
  • make ml START_TIME=TIME will only run ML phase using learning samples from data/SIZE/mcts/run-TIME/.
  • make serv will compile the server with the heuristic functions from the last run of ML phase.

0xai's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

0xai's Issues

Frontend design

  • Make interface for selecting players nicer.
  • Add red and blue borders to the hex grid.

Get ready for testing

Make page /test where testing can be set up (players, number of games, board sizes, time limits ...)

Fix import links

Imports in files are of from "github.com/RdecKa/mcts/hex". It should be "github.com/RdecKa/bachleor-thesis/mcts/hex".

Add more attributes

Ideas:

  • New patterns (two/three connected cells)
  • Separate bridges according to orientation
  • Number of free neighbours of last action

Change limit for MCTS

For now, MCTS uses a limited number of iterations. Change that in a way that will use time limit.

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.