|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SimpleTurtle Turtle Deer
public class Deer
Class that represents a deer. The deer class tracks all living deer with a linked list.
Field Summary | |
---|---|
static Color |
BROWN
class constant for the color |
static int |
MAX_SPEED
class constant for top speed (max num steps can move in a timestep) |
static double |
PROB_OF_STAY
class constant for probability of NOT turning |
protected static Random |
randNumGen
random number generator |
static double |
SMELL_RANGE
class constant for how far deer can smell |
Constructor Summary | |
---|---|
Deer(int x,
int y,
ModelDisplay modelDisplayer,
WolfDeerSimulation thisSim)
Constructor that takes the x and y and a model display to draw it on |
|
Deer(ModelDisplay modelDisplayer,
WolfDeerSimulation thisSim)
Constructor that takes the model display (the original position will be randomally 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 |
void |
die()
Method that handles when a deer dies |
AgentNode |
getClosest(double distance,
AgentNode list)
Method to get the closest wolf within the passed distance to this deer. |
void |
init(WolfDeerSimulation thisSim)
Method to initialize the new deer object |
Methods inherited from class SimpleTurtle |
---|
backward, backward, clearPath, drawInfoString, drop, forward, forward, getBodyColor, getDistance, getHeading, getHeight, getInfoColor, getModelDisplay, getName, getPen, getPenColor, getPenWidth, getPicture, getShellColor, getShowInfo, getWidth, getXPos, getYPos, hide, isPenDown, isVisible, moveTo, paintComponent, penDown, penUp, setBodyColor, setColor, setHeading, setHeight, setInfoColor, setModelDisplay, setName, setPen, setPenColor, setPenDown, setPenWidth, setPicture, setShellColor, setShowInfo, setVisible, setWidth, 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 |
---|
public static final Color BROWN
public static final double PROB_OF_STAY
public static final double SMELL_RANGE
public static final int MAX_SPEED
protected static Random randNumGen
Constructor Detail |
---|
public Deer(ModelDisplay modelDisplayer, WolfDeerSimulation thisSim)
modelDisplayer
- thing which will display the model
2param thisSim the simulationpublic Deer(int x, int y, ModelDisplay modelDisplayer, WolfDeerSimulation thisSim)
x
- the starting x positiony
- the starting y positionmodelDisplayer
- the thing that displays the modelthisSim
- the simulationMethod Detail |
---|
public void init(WolfDeerSimulation thisSim)
thisSim
- the simulation to usepublic AgentNode getClosest(double distance, AgentNode list)
distance
- the distance to look withinlist
- the list of agents to look at
public void act()
public void die()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |