Connect 4 AI Solver

Recurrent algorithms C++ and Python

I have been working on recurrent algorithms. They’re a bunch of examples in which you can implement these algorithms. However, we usually see that they are efficient.

Connect 4 is a simple game that can be easily programmed and solved to win every time. I have made in Python an AI that solves and wins. It is not programmed in C++ because I wanted a GUI.

Then I created a C++ project where I exploited the performance and reach 8 depth in a few seconds.

This is an example of a game I have played against the AI. It performs really well  🙂


  • It performs well, human-level, and sometimes overperforming.

Next steps

  • Parallel computing
  • Optimize algorithm
  • Convolutional neural network vs Recurrent algorithm
  • implementation of a complex algorithm
  • different search algorithms (Min-max searching, alpha-beta pruning, null move heuristic, quiescence searching, etc), better than brute force search


GitHub repository: C++ repository

Leave a Reply

Your email address will not be published. Required fields are marked *