Skip to content
🎮 Connect Four (also known as 4-in-a-row) is an exciting two-player puzzle connection game recreated with PyGame and Python.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Language Module Release


Connect Four is a two-player connection game in which the players first choose a colour and then take turns dropping one coloured disc from the top into a seven-column, six-row vertically suspended grid. The pieces fall straight down, occupying the next available space within the column. The objective of the game is to be the first to form a horizontal, vertical, or diagonal line of four of one's own discs.

The board size can be adjusted by changing values of board_width and board_height in program (default set to 4x6). Similarly, the PyGame window size can be adjusted by changing values of window_width and window_height (default set to 640x480).

Also feel free to pass on remarks and suggestions to increase the quality of the code.


What things you need to run the program:

  • Python Compiler (3.7 Recommended)
  • Install PyGame from pypi by using the following commands:
  pip install PyGame

How To Play

  • If you have the correct version of Python and Pygame installed, you can run the program in the command prompt / terminal.
cd connect-4
  • Drag and drop coins at the column you want to make a move.
  • Use the terminal window to view moments and other details.

Note: If you're using Python 3, replace the command "python" with "python3"

You can’t perform that action at this time.