Class WolfAgent
java.lang.Object
SimpleTurtle
Turtle
Agent
WolfAgent
- public class WolfAgent
- extends Agent
WolfAgent -- Wolf as a subclass of Agent
Constructor Summary |
WolfAgent(int x,
int y,
ModelDisplay modelDisplayer,
Simulation thisSim)
Constructor that takes the x and y and a model
display to draw it on |
WolfAgent(ModelDisplay modelDisplayer,
Simulation 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 |
void |
init(Simulation thisSim)
Initialize, by adding to Wolf list |
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 |
allWolves
public static LinkedList allWolves
- Collection of all Wolves
myX
public int myX
myY
public int myY
WolfAgent
public WolfAgent(ModelDisplay modelDisplayer,
Simulation thisSim)
- Constructor that takes the model display (the original
position will be randomly assigned)
- Parameters:
modelDisplayer
- thing that displays the modelthisSim
- my simulation
WolfAgent
public WolfAgent(int x,
int y,
ModelDisplay modelDisplayer,
Simulation thisSim)
- Constructor that takes the x and y and a model
display to draw it on
- Parameters:
x
- the starting x positiony
- the starting y positionmodelDisplayer
- the thing that displays the modelthisSim
- my simulation
init
public void init(Simulation thisSim)
- Initialize, by adding to Wolf list
- Overrides:
init
in class Agent
act
public void act()
- Method to act during a time step
pick a random direction and move some random amount up to top speed
- Overrides:
act
in class Agent