Giter VIP home page Giter VIP logo

mcts-cpp's Introduction

Monte Carlo Tree Search in C++

C++ CMake License: MIT

This project is an object-oriented implementation of the Monte Carlo Tree Search algorithm in C++. Check the examples to see how to use this library for your own games.

Algorithm

Monte Carlo Tree Search (MCTS) is an algorithm used for decision-making in game playing. It combines the exploration of possible moves, done by random simulations, with the exploitation of the most promising moves, found by evaluating their potential outcomes.

The algorithm builds a tree structure of possible game states, where each node represents a game state, and the edges are the moves that can be made.

The algorithm iteratively performs four steps: selection, expansion, simulation, and backpropagation. It starts by selecting the most promising node in the tree, then expand it by adding a new child node representing a new game state. Then, it simulates random playouts from the new node to estimate the potential outcome of that move. Finally, it backpropagates the results of the playout to the parent nodes, updating their statistics. This process is repeated until the algorithm finds the best move to make.

The four steps of Monte Carlo tree search

Getting Started

Build

This project uses CMake. To build the repository, run the following commands:

git clone https://github.com/Quentin18/mcts-cpp.git
cd mcts-cpp
cmake -S. -Bbuild
cmake --build build

Examples

Then, you can run the examples:

Game Executable
Connect Four connect4
Tic-tac-toe tictactoe
Ultimate tic-tac-toe uttt

For example, to run the Tic-tac-toe game:

cd build/bin
./tictactoe

Test

The project contains unit tests using Google Test. You can run the tests either using ctest:

cd build
ctest

Or directly using unit_tests:

cd build/bin
./unit_tests

Documentation

You can generate the documentation using doxygen:

doxygen Doxyfile

Author

Quentin Deschamps

mcts-cpp's People

Contributors

quentin18 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

longjianquan

mcts-cpp's Issues

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.