Marc Pinet

Table of Contents




Connect4 AI

📝 Description

A simple Connect4 made with C++ and SFML for the window. Currently, only the Minimax with Alpha Beta Pruning is implemented. Maybe, in the future, I'll implement other algorithms if I want to (such as MCTS?).

🎥 Demo Minimax with Alpha Beta Pruning

💡 How to use

🪟 Windows

If you've a C/C++ IDE, you should already have cmake and gcc/g++. If not, then install CMake here and gcc/g++ here.

  1. Clone the repository
git clone https://github.com/marcpinet/connect4-ai
  1. Initialize the SFML submodule
git submodule update --init --recursive
  1. Build with CMake
cmake -S . -B output -DCMAKE_BUILD_TYPE=Release -G"MinGW Makefiles"
  1. Build the project using make inside the newly created output folder
cd output && make
  1. Run the .exe

🐧 Linux / WSL

  1. Run the holy command
sudo apt-get update
  1. Install the following packages
sudo apt install libsfml-dev gdb cmake build-essential libvorbis-dev libopenal-dev freetype2-demos libudev-dev libx11-dev libxrandr-dev
  1. Clone the repository
git clone https://github.com/marcpinet/connect4-ai
  1. Initialize the SFML submodule
git submodule update --init --recursive
  1. Build with CMake
cmake -S . -B output -DCMAKE_BUILD_TYPE=Release
  1. Build the project using make inside the newly created output folder
cd output && cp -r ../assets assets && make
  1. Run the file!
chmod u+x Connect4_AI && ./Connect4_AI

📄 Note

On Windows, it will probably be easier to run the project using an IDE such as CLion.

No cache issue.