Call for help to review games & code for a new “Invent with Python” book.

UPDATE: Thanks for everyone who emailed their help. I'll leave this post up here for now, but the code seems fairly solid now.

I'm currently looking for help editing the source code for the games that will go into my next book. This book will also be released under a Creative Commons license and be freely available.

Download the game source. (Requires Python & Pygame)

UPDATE: I've fixed a problem where the midi files for the Tetris game were left out of this zip. Redownload the zip file to get them.


The games are polished and (I'm fairly certain) bug-free. I'm looking for input on anything that could make the code more readable or easier for a beginner to understand. The code is meant to be simple, which is why I don't use list comprehensions, OOP, the and/or ternary trick. I aim for readable and simple above terse.

Generally, feedback about any bugs or places where you think more comments are needed would be great! You can send them to [email protected]

4 comments.

  1. Hi Al.
    When tried playing tetromino.py, python gave me an error saying couldn’t read from ‘tetrisc.mid’.
    I think you forgot to include ‘tetrisc.mid’ in the zip file!
    regards, Rahul.

  2. Could you tell me about which games that your next book will teach?.I’m very exciting! (i’m customer of your Invent Your Own Computer Games With Python book)

  3. Hi Al,
    I just read the first book and it was a great help for me to get started in PyGame!!
    I look forward to checking out the next one.
    Thanks so much!
    Sincerely,
    Flavio

  4. Alright, here’s an oddity… for the program “SoundsAndSprites.py”, the background.mid file won’t play if the ‘b’ in ‘background.mid’ isn’t capitalized. The files name isn’t capitalized.

    Also, I have to put the full address for the file otherwise it won’t run. (Yes, the files are in the same dir as the .py file) I do have a none-standard location for python in general, could that be the problem?

    Lastly, ‘WASD’, actually works as QWERTY ‘WASD’. I have a Dvork keyboard, but only the ‘WASD’ in their qwerty positions work. Which means that ‘WASD’ is actually ‘,AOE’ on my keyboard.

Post a comment.