Connect 4 in Python

22 Jun 2012

I’m on a road trip from Santa Barbara to Portland, which should be the best time to write but the drive has given me writer’s cramp.

Connect 4

Instead, I made Connect 4 in Python, using Pygame, to refresh my Python knowledge. It only took a few hours, possibly thanks to Connect 4 being about the simplest game possible. It’s about 150 lines of code and half of that is my inefficient victory-checking code.


Yesterday I attended my second gamejam, an eight hour event where teams form to work on small games together around some loose themes, which this time were Black & White, Rockets, and Masks.


It’s early to say this, and maybe a little crazy, but I can’t help but put Twenty, a simple game from Stephen French, in the same category as Tetris. Not just in the way it plays - though it shares that methodical feeling of clearing a space that transitions to crowded panic - but in how it takes just a single mechanic and a simple interface to create something truly elegant and timeless. Twenty deserves to be played for decades to come, just like Tetris.