uwcse.sim
Class Fish

java.lang.Object
  |
  +--uwcse.sim.OilThing
        |
        +--uwcse.sim.Fish
All Implemented Interfaces:
Thing
Direct Known Subclasses:
SmartFish

class Fish
extends OilThing

Fish swim around at random, eating algae and reproducing.


Field Summary
protected  int algaeEaten
          How many algae eaten.
 
Fields inherited from class uwcse.sim.OilThing
alive, rand, world, x, y
 
Constructor Summary
Fish(WorldModel wm, int x, int y)
          Create a new fish at this location.
 
Method Summary
 void action()
          Move around at random, eating algae, and reproducing when 4 or more algae have been eaten.
 void displayOn(uwcse.graphics.GWindow g)
          Display a yellow oval.
 void interact(OilThing t)
          Kill algae, and keep track of it.
 
Methods inherited from class uwcse.sim.OilThing
checkNeighbors, getX, getY, isAlive, kill, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

algaeEaten

protected int algaeEaten
How many algae eaten.
Constructor Detail

Fish

public Fish(WorldModel wm,
            int x,
            int y)
Create a new fish at this location.
Method Detail

displayOn

public void displayOn(uwcse.graphics.GWindow g)
Display a yellow oval.
Overrides:
displayOn in class OilThing

action

public void action()
Move around at random, eating algae, and reproducing when 4 or more algae have been eaten.
Overrides:
action in class OilThing

interact

public void interact(OilThing t)
Kill algae, and keep track of it.
Overrides:
interact in class OilThing