OpenGL based Connect four game

November 5, 2011

I had been longing to post this for a long time now. Recently, I built a connect four game for one of my class assignments at Carnegie Mellon. I was inspired to build this game by a Connect Four playing machine that I built as a team member  last semester for my Mechatronic Design Class in the Spring 2011 semester. You might be interested in the video below:

The OpenGL based game code may be downloaded from my git repository:

The files needed for compiling the game is included in the repository.

It just needs to be compiled together. OpenGL needs to be installed before you compile the game.

When you launch the executable file, the console asks you the following question:

You may reply to the question with the letter y for Yes or n for No. The main game screen remains blank until this question is answered. The connect four game theme is to arrange coins of the same color vertically, horizontally or diagonally to win the game.

Once the question is answered, the game window appears as shown in the figure below:

You must use the main game screen to play the game. You may either key in the numbers 1-7 or use your mouse to click on the corresponding column on your screen.


Note: I borrowed the AI part of the code from Keith Pomakis