Class HungryWolf

java.lang.Object
  extended by SimpleTurtle
      extended by Turtle
          extended by Wolf
              extended by HungryWolf

public class HungryWolf
extends Wolf

A class that extends the Wolf to have a hunger level. Wolves only eat when they're hungry

Author:
Mark Guzdial, Barb Ericson

Field Summary
static int MAX_SATISFIED
          class constant for number of turns before hungry
 
Fields inherited from class Wolf
ATTACK_RANGE, GRAY, MAX_SPEED, PROB_OF_STAY, randNumGen, SMELL_RANGE
 
Constructor Summary
HungryWolf(int x, int y, ModelDisplay modelDisplayer, WolfDeerSimulation thisSim)
          Constructor that takes the x and y position, a model display to draw it on, and a simulation
HungryWolf(ModelDisplay modelDisplayer, WolfDeerSimulation thisSim)
          Constructor that takes the model display (the original position will be randomly assigned) and the simulation
 
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(WolfDeerSimulation thisSim)
          Method to initialize the hungry wolf object
 
Methods inherited from class Wolf
getClosest, getSimulation
 
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
 

Field Detail

MAX_SATISFIED

public static final int MAX_SATISFIED
class constant for number of turns before hungry

See Also:
Constant Field Values
Constructor Detail

HungryWolf

public HungryWolf(ModelDisplay modelDisplayer,
                  WolfDeerSimulation 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

HungryWolf

public HungryWolf(int x,
                  int y,
                  ModelDisplay modelDisplayer,
                  WolfDeerSimulation thisSim)
Constructor that takes the x and y position, 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

init

public void init(WolfDeerSimulation thisSim)
Method to initialize the hungry wolf object

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

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 Wolf