Class BirdAgent
java.lang.Object
SimpleTurtle
Turtle
Agent
BirdAgent
public class BirdAgent
- extends Agent
BirdAgents use the bird character JPEGs
- Author:
- Mark Guzdial, Barb Ericson
Constructor Summary |
BirdAgent(int x,
int y,
ModelDisplay modelDisplayer,
Simulation thisSim)
Constructor that takes the x and y, model
display to draw it on, and the simulation |
BirdAgent(ModelDisplay modelDisplayer,
Simulation thisSim)
Constructor that takes the model display (the original
position will be randomly assigned) and the simulation |
Method Summary |
void |
act(int t)
act(t) For first 20 steps, walk toward the egg,
+/- 30 degrees. |
void |
init(Simulation thisSim)
Set up the birds |
Methods inherited from class SimpleTurtle |
backward, backward, clearPath, drawInfoString, drop, forward, forward, getBodyColor, getDistance, getHeading, getHeight, getInfoColor, getModelDisplay, getName, getPen, getPenColor, getPenWidth, getShellColor, getShowInfo, getWidth, getXPos, getYPos, hide, isPenDown, isVisible, moveTo, paintComponent, penDown, penUp, setBodyColor, setColor, setHeading, setHeight, setInfoColor, setModelDisplay, setName, setPen, setPenColor, setPenDown, setPenWidth, setShellColor, setShowInfo, setVisible, setWidth, show, toString, turn, turnLeft, turnRight, turnToFace, turnToFace, updateDisplay |
BirdAgent
public BirdAgent(ModelDisplay modelDisplayer,
Simulation thisSim)
- Constructor that takes the model display (the original
position will be randomly assigned) and the simulation
- Parameters:
modelDisplayer
- thing that displays the modelthisSim
- my simulation
BirdAgent
public BirdAgent(int x,
int y,
ModelDisplay modelDisplayer,
Simulation thisSim)
- Constructor that takes the x and y, model
display to draw it on, and the simulation
- Parameters:
x
- the starting x positiony
- the starting y positionmodelDisplayer
- the thing that displays the modelthisSim
- my simulation
init
public void init(Simulation thisSim)
- Set up the birds
- Overrides:
init
in class Agent
- Parameters:
thisSim
- the simulation to use
act
public void act(int t)
- act(t) For first 20 steps, walk toward the egg,
+/- 30 degrees.
Then walk AWAY from the egg, and with MORE wandering (panic).
- Overrides:
act
in class Agent
- Parameters:
t
- the timestep