So, gentle reader, you probably think I’ve been quite lazy. Not true – here’s a working game in Python! As you might guess from the title, I’ve made a little chess game. It is pretty simple and has no graphics. Ah, well – you have to start somewhere! Right now Python Chess supports two players; no AI opponent yet. Input is via keyboard entry.
It was pretty easy to code – 458 lines, took me about 5-10 hours (an hour here and there over a few days) from start to finish. Before starting, I had read through the tutorial on the Python website and consulted it when I needed to get specific syntax for something.
I didn’t have any large design errors, largely thanks to a solid understanding of the (relatively simple) game mechanics. The game of chess is pretty well defined in my head; for future development of other, more complex games, I think it will be more important to spend some serious time up front generating a design document. I didn’t do that for Python Chess because it’s pretty simple…just kind of added functionality as I decided it was needed. I know, I know…terrible programming practice!
Download: Python Chess version 0.1 (Note: for some reason, if you try to Right-click – Save As and download this file, Google Sites will scramble the file name. If you would like, you I put a zip file up as well…it’s name will get scrambled, too, when you save but when you unzip it the names of the files inside are intact.)
You’ll need the Python interpreter to run this file. If you don’t have it, you can get it for free from http://www.python.org/download/.