The Invent with Python Blog

Writings from the author of Automate the Boring Stuff.

Fri 25 June 2010 A Remake of Gorillas.bas

Posted by Al Sweigart in pygame   

Source code:

An entire generation of people remember the Gorilla.BAS game that came with Qbasic, where gorillas on top of buildings threw exploding bananas at each other. This is a Python remake of that game using the Pygame game engine, and is fairly heavily commented so you can explore the source. To play the game in your browser, there is also a Flash version of Gorillas.BAS.

My prime motivation behind creating this was to compare how much easier programming is today compared to a decade ago with Qbasic. Python makes a great first language to learn, and I have argued before how Python is the New BASIC. (The second motivation was to promote my (free) book on Python games and get people back into programming. :) )

To demonstrate: not counting blank lines and comments (and the multiline strings for the graphics), Qbasic's gorillas.bas is 784 lines of code while Python's is 544 lines of code (about 30% less code!) Every programmer's mileage may vary, but I think that makes a good case for Python's syntax being expressive and simple.

Screenshot of game

This game was written by the author of "Invent Your Own Computer Games with Python", a free book available under a Creative Commons license at The book teaches Python to kid and adult beginners by giving the source code to several different games (along the lines of and explaining them line by line. Learning to program this way is fun!

A print copy of the book is available (with free shipping) on for $25.

Learn to program for free with my books for beginners:

Sign up for my "Automate the Boring Stuff with Python" online course with this discount link.