/connect-four

An AI for Connect Four using Monte Carlo Tree Search

Primary LanguageC++MIT LicenseMIT

connect-four

An implementation of (an AI for) the classic board game Connect Four. The AI uses Monte Carlo Tree Search to choose its actions. In particular, it uses Upper Confidence Bound 1 applied to trees (UCT) as the tree policy. Try and see if you can beat it!

screenshot

Dependencies

The main dependency is the SDL2 library used for the GUI. To run the project, you'll need the following:

Usage

Make sure all of the dependencies mentioned above are installed. Then, clone and enter the repo:

git clone https://github.com/leotappe/connect-four.git
cd connect-four

Create and enter a build directory:

mkdir build
cd build

Compile using cmake and make:

cmake ..
make

There should now be an executable in your build directory named connect4. You can run it using

./connect4

Have fun!

Resources

I used the following material to learn about Monte Carlo Tree Search: