Class EggAgent
java.lang.Object
SimpleTurtle
Turtle
Agent
EggAgent
public class EggAgent
- extends Agent
EggAgent -- big scary egg that sits there until t=30,
then emerges as a monster!
- Author:
- Mark Guzdial, Barb Ericson
Constructor Summary |
EggAgent(int x,
int y,
ModelDisplay modelDisplayer,
Simulation thisSim)
Constructor that takes the x and y, a model
display to draw it on, and a simulation |
EggAgent(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)
To act, just drop the Egg for 15 steps,
then be the eyes opened for five steps,
then be the eyes switching back-and-forth |
void |
init(Simulation thisSim)
To initialize, set it up as the Egg in the upper lefthand corner |
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 |
EggAgent
public EggAgent(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
EggAgent
public EggAgent(int x,
int y,
ModelDisplay modelDisplayer,
Simulation thisSim)
- Constructor that takes the x and y, a model
display to draw it on, and a 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)
- To initialize, set it up as the Egg in the upper lefthand corner
- Overrides:
init
in class Agent
- Parameters:
thisSim
- the simulation
act
public void act(int t)
- To act, just drop the Egg for 15 steps,
then be the eyes opened for five steps,
then be the eyes switching back-and-forth
- Overrides:
act
in class Agent
- Parameters:
t
- the timestep