Giter Site home page Giter Site logo

fredboe / monte-carlo-tree-search Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 119 KB

Little program for MCTS and alpha-beta-pruning that can play connect4 against each other.

License: MIT License

Python 100.00%
monte-carlo-tree-search connect4-ai-game connect4 alpha-beta-pruning mcts mcts-algorithm mcts-connectfour

monte-carlo-tree-search's Introduction

monte-carlo-tree-search

Project

This project contains a basic implementation of the Monte Carlo Tree Search. Furthermore, you can find some other agents (AlphaBeta, Random) which you can try out against MCTS.

For those who find this algorithm interesting I will also add some further reading/information below.

Code

I would be really pleased about some suggested improvements for my code or other stuff like documentation.

Execute the code

The first execution

To see a first result just execute RunMatch.py

python RunMatch.py

Changing the agents

To change the agents you just need to change the first parameter in the Match obj. The possible agents are "MCTS", "REALWORLD" (you can play), "ALPHABETA" and "RANDOM". The first element of the tuple is player 1. The second element of the tuple is player 2.

match = Match(("MCTS", "ALPHABETA"), start_board)

Change some parameters

There are some parameters you can change to experiment with the results.
For example, you can change the depth in AlphaBeta.py (line 6).

def get_action(self, state, player_id, depth=6):

another parameter you can change is max_time in MCTS.py (line 129). With this you can change the duration of MCTS.

def runMCTS(self, player_id, max_time=5):

Further readings

monte-carlo-tree-search's People

Contributors

fredboe avatar

Stargazers

 avatar

Watchers

 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.