MCTS Tic Tac Toe Playground

ggrn
5,129 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Goal

The goal of this playground is show how the Monte Carlo Tree Search (MCTS) algorithm works, applied to a simple two player game. It is oriented towards people who are acquainted with the theory of MCTS but experience difficulties implementing it. Below is a basic and (hopefully) easy to follow implementation demonstrating the game play of Tic Tac Toe. For ease of reading the four main steps of the algorithm are indicated as comments in the code.

Notice

The code below does not use best practices in programming or MCTS implementation. This playground is to be perceived as a proof of concept example of how the algorithm works. If you want you can contribute by making it more accessible by restructuring it or by translating the code to other languages.

Code

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content