Monte Carlo tree search (MCTS) is a heuristic search algorithm for some kinds of decision processes. Hence, perfect for board games such as connect 4. To balance between exploration and exploitation, the UCT formula will be used since it's the formula that combines the node value concept of MCTS and the UCB formula. (Read More)
The first issue I face facing was that the algorithm sometimes overlooks the possibility of a terminal move from the opponent. Instead it choses a move that might seem better to him (when it's clearly not the case). However this was due to the Exploration constant C being set too high at 2. After decreasing it to 1.4 (almost root(2) which is the recommended exploration for the UCT function).
After cloning create the following folders :
mkdir bin obj
Then run the following command :
make all
Finally launch the game with :
./bin/connect4v2
-
Clone the repo
-
Navigate into the repo
-
Compile the c file : Eg:
make connect4
orgcc connect4.c -o connect4
-
Run
./connect4
(ifmake connect4
was used).
PS: Everything should be done within the terminal
- Build an interface with NCurses
- Introduce playing against an AI
Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.
This project is licensed under the MIT License - see the LICENSE file for details.