Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Connect Four

The Connect Four game, implemented in Python.


  • All the Connect Four rules
  • State of the art graphics
  • Chips that made the player win are highlighted
  • Sound effects!
  • Musics!
  • Player's score
  • Two players, either:
    • On the same computer
    • (WIP) LAN game
    • (WIP) Online game


Python 3. May eventually works with Python 2 (not tested).


Clone this repo, and then the usual pip install -r requirements.txt.


python [--dev]

--dev enable WIP features (like network games).


  • ESC quits to the menu or close the game when already on the menu
  • and moves the chip respectively to the left and to the right
  • drops the chip in the selected column
  • starts a new game when one is finished

How it works

This game is built on top of PyGame. I obviously can't explain how it works here, so you'll have to jump yourself in the source code. Start with the entry point,

Beside the game itself, I use PyInstaller to generate the executables. It packs up all the game and its assets in a single executable file so players just have to run it with nothing to install. This task is performed by the build_* scripts to be run in the corresponding OS.

Network gaming is done by WebSockets using Autobahn. A master server (with the help of a REST API) is used to centralize all the online Connect Four games.


  • Board graphics by François Haffner (public domain)
  • Sound effects by (©
  • Musics by (Royalty-Free)
  • Font by Tobias Benjamin Köhler (freeware)
  • Thanks to the Swervin Mervin game's source code who helped me a lot to properly design the architecture of my game and understand the PyGame mechanics
  • Connect Four™ is a trademark of Milton Bradley / Hasbro. This project isn't supported nor endorsed by Milton Bradley / Hasbro


This is my very first game I ever crafted, and my very first projet using PyGame, so please be indulgent.

End words

If you have questions or problems, you can submit an issue.

You can also submit pull requests. It's open-source man!