Object Mentor, Inc.

objectmentor

«about»
  + mission
  + philosophy
 
+ our team
  + contact
  + careers
«learn now!»
  + schedule
  + register
«what we do»
  + overview
  + training
  + mentoring
  + development
  + testimonials
  + XP
«publications»
  + articles
  + by subject()
  + by author()
«freeware»
  + browse
  + download
«member area»
  + register
  # edit password
«fun»
  + wator

  fun::wator

Wator
A Java Applet
A predator/prey model
(keep watching, it gets interesting)

Click here to see the code.
This version of Wator is much faster than previous versions. I am using a much better algorithm for determining which animals are active, and which are dormant. This greatly improves the speed when the screen is full of fish that cannot move.

Welcome to the world of Wator. Wator was invented by A. K. Dewdney, in his "Computer Recreations" article in the December, 1984 issue of Scientific American. Wator is a world that is covered in water, and shaped like a torus. The map above is that torus unfolded.

Within the water of Wator live tiny cells. Most of these cells are algae. Algae is white and you cannot see it. It reproduces very quickly and is virtually unlimited. Sometimes an algae cell will spontaneously mutate into a hebivorous green cell called a "fish". The fish wander about eating the algae and reproducing. Once a fish appears, it doesn't take long for the entire world to be covered with them.

Every once in a great while, a fish will mutate into an orange carnivorous form called a "shark". Sharks wander around the torus of Wator, eating fish and reproducing. If a shark doesn't find a fish to eat within a specific period of time, it starves to death. Sharks cannot reproduce unless they eat.

Sharks can mutate too. Rarely, the time that a shark can survive without eating is randomly increased or decreased. The color of a shark depends upon this time factor according to the following table.

Time it takes to starve 2 turns 3 turns 4 turns 5 turns 6 turns 7 turns 8 turns >8 tiurns
Color Yellow Orange Red Grey Magenta Blue Cyan Black

The patterns that these tiny creatures form on the Wator map can be hypnotizing. They are quite pretty. But more than that, they tell a picture of a violent and precarious existence.

The creatures of Wator suffer through catastrophe after catastrophe as the predator-prey ratio continually oscillates. Sometimes there are so many sharks that they eat nearly all the fish. Then the sharks die off in hordes. Occasionally, only one or two are left.

You will see the effect of mutations upon sharks. The ability to live longer between meals is a significant advantage. And yet, "superior" forms of sharks often die out due to the fierce competition from the "inferior" forms. Indeed, I have seen whole populations of "superior" sharks replaced their own "inferior" mutants.

Another thing that is very clear after watching these simulations is that it is the catastrophes that have the most profound effect upon the ratio of mutations. After a really bad catastrophe, only one or two sharks may be able to survive. Those that can live longer between meals are more likely to be among the surviors, and they then repopulate the world with their own kind.


Wator is a Java applet written for my own entertainment and education. It is public domain, and you can do anything you want with it so long as you don't take my copyright notice out of it. The program is instructive because it shows a number of interesting features of Java, as well as using some clever animation techniques. Among other things, it makes use of inner classes, anonymous classes, and threads.

Enjoy.

space
Object Mentor, Inc.