|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sysModel.fish.AFish model.fish.KnightFish
public class KnightFish
A fish that moves like a knight in chess. _ _ _ _ _ |_|0|_|1|_| |7|_|_|_|2| |_|_|X|_|_| |6|_|_|_|3| |_|5|_|4|_|
If the fish is located at the X, then the locations labelled 0 through 7 should be reachable. The target location is selected at random. When moving, the fish should always make two steps in one direction, then one step over, NOT one step in one direction, then two steps over. While the destination is the same, the locations visited are different. If the fish is blocked on the way to the target location, the fish should just stop in that place. After the move has been executed, the fish is left facing in the direction of the last step (the "one over" step).
Field Summary |
---|
Fields inherited from class sysModel.fish.AFish |
---|
_fishColor, _fishDisplay, _probOfBreeding, _probOfDying |
Constructor Summary | |
---|---|
KnightFish(java.awt.Color fishColor)
Make a new knight fish. |
Method Summary | |
---|---|
protected void |
move()
Execute the movement part of a simulation step. |
Methods inherited from class sysModel.fish.AFish |
---|
act, age, breed, clone, die, draw, getColor, paint, setLocalEnvironment, setProbOfBreeding, setProbOfDying, toString, tryBreedFwd, tryMoveFwd, turnLeft, turnLeft, turnRight, turnRight, update |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public KnightFish(java.awt.Color fishColor)
fishColor
- color of the fishMethod Detail |
---|
protected void move()
move
in class AFish
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |