Fri 25 February 2011

New Extra Game: Connect Four clone

Posted by Al Sweigart in misc   

I have a text version of a Connect Four clone done. The AI for it looks ahead two moves, which makes it fairly impossible to beat unless you concentrate. I was planning to use this game for a chapter on recursion in my next book, but decided to publish the code for the text-version now.

Download fourinarow.py (This is for Python 3, not Python 2)

The code has few comments, but looking at its source code might be a good exercise for someone learning to program. It's available on the book's website in the Extra section.