Wa-Tor World Assignment

Mike Scott, University of Texas at Austin, scottm@cs.utexas.edu


Basic Wa-Tor World GUI      Advanced Wa-Tor World GUI


Description and Meta Data

Summary Implement a program that carries out the simulation proposed by A.K. Dewdney is his article Sharks and Fish Wage an Ecological War on the Toroidal Planet Wa-Tor, Scientific America Computer Recreations column. (Available in the book The Armchair Universe.) Wa-Tor World a biological simulation of two species with various parameters such as time between breeding and time before starving. The assignment focuses on creating a GUI to display the simulation. The simulation itself is built on the College Board's APCS GridWorld case study.
Topics Construction of GUIs. Data transformation and visualization. Object based programming. Variations could emphasize 2D array operations, OOP concepts (inheritance and polymorphism).
Audience Late CS1, early CS2, or non CS majors graphics class.
Difficulty Varies with amount of code provided. Starting from scratch, this would be a difficult assignment. (multiple assignments over many weeks.) The version presented is relatively simple because the simulation is already provided. Two weeks for non CS majors to complete the assignment.
Strengths Strengths include:
  • The output of the program is visual.
  • Problem is big enough that several variants could be made such as starting from scratch and developing the problem over many assignments OR providing the GUI and the GridWorld classes and having the students implement the Fish, Shark, WrappedBoundedGrid, and WatorWorld classes OR give all the simulation code and have the students develop the GUI. For a graphics class different controls can be added so the simulation can be run with different starting parameters.
  • The simulation can easily involve 1000's of fish and sharks so Astrchan's Law is met.
  • Assignment can be tied to something students studied in biology. The variance of the fish and shark populations over time are similar to the predicted results of the Lotka–Volterra equation. (a.k.a. the predator - prey equation).
  • Can be built on the APCS GridWorld case study code.
  • Shows the power / necessity of classes and inheritance. Given BoundedGrid creating WrappedBoundedGrid is almost trivial.
  • Other types of creatures could be introduced. Add more complex behaviors.
Weaknesses Weaknesses include:
  • It's been done before. Lots of versions can be found on the web.
  • Debugging based on the visual display is very difficult. (This could be a strength though, as students would have to write tester code instead of just running the program.)
  • If the create the GUI version of the assignment is used not a lot of transferable skills. (Doing a GUI in Java does not translate well to other languages. For CS1 and CS2 classes, much better to give the GUI and have students do the simulation code.)
Dependencies Varies with version of assignment.
  • GUI version: GUI components and programming, using documentation, lists
  • Simulation only version: 2d arrays, creating classes, inheritance, encapsulation, ability to work with many classes and read documentation
  • From scratch: All of GUI version and simulation version, plus ability to design programs and handle complexity / details.
Variants As described: 1. Whole thing from scratch. 2. Just the GUI. 3. Just the simulation. (Give the GUI, give the APCS GridWorld Code.)

Support Material:

Slides from presentation at SIGCSE: PowerPoint or PDF

Assignment handout I use in my graphics class for non CS majors

Directory with current version of assignment source code  (Uses APCS GridWorld code)

All the starter code in a zip file

Javadoc for the simulation code

Executable jar version of program

Extra info about this assignment: