Class Deer

java.lang.Object
  extended bySimpleTurtle
      extended byTurtle
          extended byDeer

public class Deer
extends Turtle

Class that represents a deer. The deer class tracks all living deer with a linked list.

Author:
Barb Ericson ericson@cc.gatech.edu

Constructor Summary
Deer(int x, int y, ModelDisplay modelDisplayer)
          Constructor that takes the x and y and a model display to draw it on
Deer(ModelDisplay modelDisplayer)
          Constructor that takes the model display (the original position will be randomally 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 die()
          Method that handles when a deer dies
static Deer getHead()
          Method to get the head of the linked list of deer
 Deer getNext()
          Method to get the next Deer in the linked list
 void init()
          Method to initialize the new deer object
static void main(java.lang.String[] args)
          main method for testing
 
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
 

Constructor Detail

Deer

public Deer(ModelDisplay modelDisplayer)
Constructor that takes the model display (the original position will be randomally assigned

Parameters:
modelDisplayer - thing which will display the model

Deer

public Deer(int x,
            int y,
            ModelDisplay modelDisplayer)
Constructor that takes the x and y and a model display to draw it on

Parameters:
x - the starting x position
y - the starting y position
modelDisplayer - the thing that displays the model
Method Detail

getHead

public static Deer getHead()
Method to get the head of the linked list of deer

Returns:
the head of the linked list of deer (may be null)

getNext

public Deer getNext()
Method to get the next Deer in the linked list

Returns:
the next deer in the linked list of deer or null

init

public void init()
Method to initialize the new deer object


act

public void act()
Method to act during a time step pick a random direction and move some random amount up to top speed


die

public void die()
Method that handles when a deer dies


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
main method for testing

Throws:
java.lang.Exception