Object-Oriented Tower Defense: Ants vs SomeBees

The bees are coming!
Create a better soldier
With inherit-ants.

Developed by John DeNero, Tom Magrino, and Eric Tzeng at UC Berkeley.

The Ants Vs. SomeBees assignment implements an action game strongly inspired by the PopCap Games' mega-hit, Plants Vs. Zombies ®. It is designed as a first assignment introducing the Python object system, and it includes questions aligned with the core ideas of object-oriented programming: local state, inheritance, composition, overloading, and method lookup.

Building an action game with complicated interaction can be a headache for students. This game is entirely turn-based under the hood, to facility incremental testing and development. A provided GUI gives the illusion of action by enforcing a turn clock and animating the bees. As a result, the game is quite entertaining to play.

Among four projects in Berkeley's introductory programming course, CS 61A, 46% of students listed this project as their favorite, and 28% found that it taught them the most (eclipsed only by implementing a Scheme interpreter).

Some positive student reactions, shamelessly cherry-picked from our end-of-semester survey:

"The projects in CS61A are AWESOME. I really enjoyed [Ants vs. SomeBees], it was actually amazing to think that we could build parts of a working game this early in my programming career, and the theme was interesting (I'm actually interested in games, so that might explain).
"Ants vs. SomeBees was cool because we could see our progress through the project by playing the game over and over again in stages."
"There should be more projects like [Ants vs. SomeBees]. I found making a spin-off of a popular game to be extremely fun; it hardly felt like I was doing work!"
"[Ants vs. SomeBees] taught me the most because prior to 61A, I was only familiar with procedural programming. [Ants vs. SomeBees] introduced me to the object-oriented paradigm."
"The Ants project was awesome!"

Readings relevant to the project can be found in Chapter 2.5 of Composing Programs.
Summary Build a game in which ants with various special powers throw leaves at the evil bees.
Object-oriented programming, mutable local state, classes, inheritance, and method resolution.
Appropriate for CS1 students just introduced to the object system in Python.
This assignment takes 2 weeks for our CS 1 students. Among the four projects for the course, this one seemed to be considered the third most difficult.
The final game is fun, and the intermediate partial implementations that students build along the way are also reasonably entertaining to play. The design allows for lots of focused testing and incremental development. Later questions explore interesting advanced features of the Python object system.
The project comes with a lot of scaffolding and progress is scripted. Some students wished that they had more freedom to design the program themselves. For more advanced students, removing some of the starter code would provide more of a challenge.
Requires understanding the Python object system. The project has no dependencies beyond Python 3.
Some students designed their own types of ants to extend the project.