Excerpt from Description of Exercise

Objective: To gain experience working with 2 dimensional arrays.

The field of artificial life uses computer simulations to explore the behavior of living systems. For this lab, we will have you construct a simple example of such a ``living'' simulation.

The scenario we want you to model comes from the text ``Turtles, Termites and Traffic Jams'' by Mitchel Resnick. In his book, Resnick uses simple computer simulations to illustrate the idea that the members of a large population may appear to exhibit cooperative or coordinated behavior when they are actually functioning quite independently and following very simple rules that dictate their individual behaviors. One of the examples in the text involves the simulation of termites moving wood chips about in a simulated world. We would like you to construct a simulation similar to Resnick's termite program.

The world to be simulated starts out with a large number of wood chips and a somewhat smaller number of termites randomly spread about. The termites then begin to wander about completely aimlessly. At each step, a termite may move up, left, down or right regardless of the direction of its previous steps. If a termite happens to bump into a wood chip, it picks it up. It carries the wood chip around as it wanders until it bumps into another wood chip. At that point, it puts its chip down on an empty spot and wanders off randomly to repeat this process.

The surprising thing about this simulation is that although the action of the individual termites is random, the result of their combined work appears to be coordinated. As time progresses, the termites tend to gather all the wood chips into larger and larger piles.

Note: This exercise can lead to interesting discussions of the potential for unexpected interactions between ActiveObjects since the termites all share access to the array that represents the wood chips.

Handouts Describing the Exercise

Student Resources for Lab Exercise

Sample solutions