| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectA4Shell.WatorWorld
public class WatorWorld
Provides a simulation of a Wat-or World as described by A.K. Dewdney in his Scientific American article: Sharks and fish wage an ecological war on the toroidal planet Wa-Tor.
| Constructor Summary | |
|---|---|
| WatorWorld(int rows,
           int cols,
           int numFish,
           int numSharks)Create a new Watorworld. | |
| Method Summary | |
|---|---|
|  java.awt.Color | getColor(int row,
         int col)Return the color of the object at the specified cell. | 
|  int | getNumCols()Get the number of columns in this world. | 
|  int | getNumFish()Return the number of fish in the simulation. | 
|  int | getNumSharks()Return the number of sharks in the simulation. | 
|  int | getNumSpots()Get the total number of cells in this world. | 
|  int | numRows()Get the number of rows in this world. | 
|  void | reset(int numFish,
      int numSharks)Reset the world. | 
|  void | step()Perform one step of the simulation. | 
|  java.lang.String | toString() | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public WatorWorld(int rows,
                  int cols,
                  int numFish,
                  int numSharks)
rows - rows > 0, number of rows in worldcols - cols > 0, number of cols in worldnumFish - The number of fish initiallynumSharks - The number of sharks initially| Method Detail | 
|---|
public void reset(int numFish,
                  int numSharks)
numFish - The number of fish to add to the worldnumSharks - The number of fish to add to the worldpublic void step()
public int getNumFish()
public int getNumSharks()
public java.awt.Color getColor(int row,
                               int col)
row - the row valuecol - the column value
public int numRows()
public int getNumCols()
public java.lang.String toString()
toString in class java.lang.Objectpublic int getNumSpots()
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||