|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SimpleTurtle Turtle Wolf
Class that represents a wolf. The wolf class tracks all the living wolves with a linked list.
Constructor Summary | |
Wolf(int x,
int y,
ModelDisplay modelDisplayer)
Constructor that takes the x and y and a model display to draw it on |
|
Wolf(ModelDisplay modelDisplayer)
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 |
Deer |
getClosestDeer(double distance)
Method to get the closest deer within the passed distance to this wolf |
static Wolf |
getHead()
Method to get the head of the linked list of wolves |
Wolf |
getNext()
Method to get the next Wolf in the linked list |
void |
init()
Method to initialize the new wolf object |
static void |
main(java.lang.String[] args)
main method for testing |
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 |
Constructor Detail |
public Wolf(ModelDisplay modelDisplayer)
modelDisplayer
- thing that displays the modelpublic Wolf(int x, int y, ModelDisplay modelDisplayer)
x
- the starting x positiony
- the starting y positionmodelDisplayer
- the thing that displays the modelMethod Detail |
public static Wolf getHead()
public Wolf getNext()
public void init()
public Deer getClosestDeer(double distance)
distance
- the distance to look within
public void act()
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |