Monte Carlo Tree Search Based AI Connect 4 Bot
About the game
Connect 4 is a two-player game in which the players take turns dropping colored discs from the top into a seven-column, six-row vertically suspended grid. The pieces fall straight down, occupying the next available space within the column. The objective of the game is to be the first to form a horizontal, vertical, or diagonal line of four of one's own discs.
It must be noted that this is a solved game (the first player can always win with right moves), the purpose of this project is mianly to implement the algorithm and test its performance in a simple game. We encourage users to find those right moves!
Monte Carlo Tree Search is a recently proposed search method that combines the precision of tree search with the generality of random sampling. It does not depend on heuristic function to evaluate the best next move to make, rather it just considers the game mechanics to play random rollouts and get an expected reward after a fixed number of iterations.
Here we attach some of papers as part of the literature revised for developing this project:
- A Survey of Monte Carlo Tree Search Methods
- Monte-Carlo Tree Search and Minimax Hybrids
- Score Bounded Monte-Carlo Tree Search
- On the Dangers of Random Playouts
Running the game
The code was written in Python 2.7. In order to display the game's GUI, we used Tkinter module, which is the standard Python interface to the Tk GUI toolkit. Although you don't need to download Tkinter since it is an integral part of all Python distributions. In any case, you can find more details about Tkinter installation here.
git clone https://github.com/Alfo5123/Connect4.git cd Connect4 python game.py
This project is licensed under the MIT License - see the LICENSE.md file for details
- Samuel Vidal, for suggesting this challenge.