Class DeerAgent

java.lang.Object
  extended by SimpleTurtle
      extended by Turtle
          extended by Agent
              extended by DeerAgent

public class DeerAgent
extends Agent

DeerAgent -- Deer as a subclass of Agent

Author:
Mark Guzdial, Barb Ericson

Field Summary
static LinkedList<DeerAgent> allDeer
          Collection of all Deer
static Color BROWN
          class constant for the color
static double SMELL_RANGE
          class constant for how far deer can smell
 
Fields inherited from class Agent
MAX_SPEED, PROB_OF_STAY, randNumGen
 
Constructor Summary
DeerAgent(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
DeerAgent(ModelDisplay modelDisplayer, Simulation thisSim)
          Constructor that takes the model display (the original position will be randomly assigned) and the simulation
 
Method Summary
 void act()
          How a DeerAgent acts
 void die()
          To die, do normal stuff, but also remove from deer list
static LinkedList<DeerAgent> getDeer()
          Method to get the linked list of deer
 void init(Simulation thisSim)
          Initialize, by adding to Deer list
 
Methods inherited from class Agent
act, countInRange, getClosest, getPicture, getSimulation, getSpeed, setPicture, setSpeed
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BROWN

public static final Color BROWN
class constant for the color


SMELL_RANGE

public static final double SMELL_RANGE
class constant for how far deer can smell

See Also:
Constant Field Values

allDeer

public static LinkedList<DeerAgent> allDeer
Collection of all Deer

Constructor Detail

DeerAgent

public DeerAgent(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 model
thisSim - my simulation

DeerAgent

public DeerAgent(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 position
y - the starting y position
modelDisplayer - the thing that displays the model
thisSim - my simulation
Method Detail

getDeer

public static LinkedList<DeerAgent> getDeer()
Method to get the linked list of deer

Returns:
the linked list of deer

init

public void init(Simulation thisSim)
Initialize, by adding to Deer list

Overrides:
init in class Agent
Parameters:
thisSim - the simulation

die

public void die()
To die, do normal stuff, but also remove from deer list

Overrides:
die in class Agent

act

public void act()
How a DeerAgent acts

Overrides:
act in class Agent