|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSimulator
public class Simulator
A simple predator-prey simulator, based on a rectangular field containing rabbits and foxes.
Constructor Summary | |
---|---|
Simulator()
Construct a simulation field with default size. |
|
Simulator(int depth,
int width)
Create a simulation field with the given size. |
Method Summary | |
---|---|
void |
reset()
Reset the simulation to a starting position. |
void |
runLongSimulation()
Run the simulation from its current state for a reasonably long period, (4000 steps). |
void |
simulate(int numSteps)
Run the simulation from its current state for the given number of steps. |
void |
simulateOneStep()
Run the simulation from its current state for a single step. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Simulator()
public Simulator(int depth, int width)
depth
- Depth of the field. Must be greater than zero.width
- Width of the field. Must be greater than zero.Method Detail |
---|
public void reset()
public void runLongSimulation()
public void simulate(int numSteps)
numSteps
- The number of steps to run for.public void simulateOneStep()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |