|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSimpleTurtle
Turtle
Wolf
Class that represents a wolf. The wolf class tracks all the living wolves with a linked list.
Field Summary | |
protected static int |
maxSpeed
class constant for top speed (max num steps can move in a timestep) |
protected WolfDeerSimulation |
mySim
My simulation |
protected static double |
PROB_OF_STAY
class constant for probability of NOT turning |
protected static Random |
randNumGen
random number generator |
Constructor Summary | |
Wolf(int x,
int y,
ModelDisplay modelDisplayer,
WolfDeerSimulation thisSim)
Constructor that takes the x and y and a model display to draw it on |
|
Wolf(ModelDisplay modelDisplayer,
WolfDeerSimulation thisSim)
Constructor that takes the model display (the original position will be randomly assigned) |
Method Summary | |
void |
act()
Method to act during a time step pick a random direction and move some random amount up to top speed |
AgentNode |
getClosest(double distance,
AgentNode list)
Method to get the closest deer within the passed distance to this wolf. |
void |
init(WolfDeerSimulation thisSim)
Method to initialize the new wolf object |
Methods inherited from class Turtle |
square |
Methods inherited from class SimpleTurtle |
backward, drawInfoString, drop, forward, forward, getBodyColor, getDistance, getHeading, getInfoColor, getModelDisplay, getName, getPen, getPenColor, getPenWidth, getPicture, getShellColor, getShowInfo, getXPos, getYPos, hide, isPenDown, isVisible, moveTo, paintComponent, penDown, penUp, setBodyColor, setColor, setHeading, setInfoColor, setModelDisplay, setName, setPen, setPenColor, setPenDown, setPenWidth, setPicture, setShellColor, setShowInfo, setVisible, show, toString, turn, turnLeft, turnRight, turnToFace, turnToFace, updateDisplay |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static final double PROB_OF_STAY
protected static final int maxSpeed
protected WolfDeerSimulation mySim
protected static Random randNumGen
Constructor Detail |
public Wolf(ModelDisplay modelDisplayer, WolfDeerSimulation thisSim)
modelDisplayer
- thing that displays the modelthisSim
- my simulationpublic Wolf(int x, int y, ModelDisplay modelDisplayer, WolfDeerSimulation thisSim)
x
- the starting x positiony
- the starting y positionmodelDisplayer
- the thing that displays the modelthisSim
- my simulationMethod Detail |
public void init(WolfDeerSimulation thisSim)
public AgentNode getClosest(double distance, AgentNode list)
distance
- the distance to look withinlist
- the list of agents to look at
public void act()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |