Screenshot of Ants Versus Somebees
A game of Ants Vs. SomeBees consists of a series of turns. In each turn, new bees may enter the ant colony. Gamers select new ants and place them in the colony. Finally, all insects (ants, then bees) take individual actions: bees sting ants, and ants throw leaves at bees. The game ends either when a bee reaches the ant queen (you lose), or the entire bee flotilla has been vanquished (you win).
The Colony. The colony consists of several places that are chained together. The
exit of each
Place leads to another
Placing Ants. There are two constraints that limit ant production. Placing an ant uses up some amount of the colony’s food, a different amount for each type of ant. Also, only one ant can occupy each
Bees. When it is time to act, a bee either moves to the
exit of its current
Place if no ant blocks its path, or stings an ant that blocks its path.
Ants. Each type of ant takes a different action and requires a different amount of food to place. The two most basic ant types are the
HarvesterAnt, which adds one food to the colony during each turn, and the
ThrowerAnt, which throws a leaf at a bee each turn.
Most concepts in the game have a corresponding class that encapsulates the logic for that concept. For instance, a
Place in the colony holds insects and connects to other places. A
Bee stings ants and advances through exits.
Here is a listing of specification and prototypes for the main classes: Place, Insect, and Colony classes and the associated subclasses:
The game can be run in three modes: as a text-based game, a low-resolution graphical user interface, and an advanced Web-based GUI. The game logic is the same in all cases, but the GUIs enforce a turn time limit that makes playing the game more exciting. The text-based interface is provided for debugging and development.
The full module and problem sets can be found at this link http://cs61a.org/proj/ants/
Unzip the ants.zip archive by downloading http://cs61a.org/proj/ants/ants.zip . The main program file is
ants.py, which knows nothing of graphics or turn time limits, as those aspects can be considered hidden information.
To start a text-based game, go to a shell and change directories to ants, then run
To start a tkinter-based graphical game, run
To start a web-based graphical game, run
A Class Diagram for Ants versus Somebees
No comments yet.