New Game Source Code: Four in a Row

I’ve made a Connect Four AI. There is a text-only version and a graphical version made with Pygame. You will need Python 3 (not Python 2) to play the games (and Pygame for the graphical version.)

In the graphical version, drag the red tokens over the top of the board to make a move.

Source Code and image files zipped.

fourinarow.py (text version, doesn’t need Pygame)

gFourinarow.py (graphical version, needs image files)

Black token image, Red token image, Board image

4 comments.

  1. Neat. Next it would be cool to port an AI Mind like http://www.scn.org/~mentifex/AiMind.html into Python.

  2. Very nice game, I’m planning to integrate it into a collection of educational games for children, ‘childsplay’ which is licensed under the GPL-3 license. http://sourceforge.net/projects/schoolsplay/
    Can I put chunks of your code under the GPL-3 License ?
    Of course I will send you upgraded images for the game as well as any improvements we perhaps make.

  3. I may be mistaken, but the text link seems to refer to a program that requires pygame.

  4. Thanks for pointing that out Will! I’ve fixed the link. It now goes to the text-based version of the game.

Post a comment.

Switch to our mobile site