|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectA4Shell.Actor
A4Shell.Shark
public class Shark
A class to model a Shark in the Wator simulation.
| Constructor Summary | |
|---|---|
Shark()
Create a new shark. |
|
| Method Summary | |
|---|---|
void |
act()
Check if starve then if not, act to move and breed if time. |
char |
getChar()
Return the character for Sharks. |
static int |
getNumSharks()
Returns the current number of sharks. |
static void |
resetNumSharks()
Reset number of sharks to 0. |
static void |
setBreedTime(int newBreedTime)
Change the base number of turns before sharks can breed |
static void |
setStarveTime(int newStarveTime)
Change the base number of turns a shark must eat within or starve |
| Methods inherited from class A4Shell.Actor |
|---|
getColor, getDirection, getGrid, getLocation, isEdible, moveTo, putSelfInGrid, removeSelfFromGrid, setColor, setDirection, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Shark()
| Method Detail |
|---|
public static int getNumSharks()
public static void resetNumSharks()
public static void setBreedTime(int newBreedTime)
newBreedTime - new number of turns. Must be > 0.public static void setStarveTime(int newStarveTime)
newStarveTime - new number of turns. Must be > 0public void act()
act in class Actorpublic char getChar()
getChar in class Actor
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||