Class KnightFish

  extended by
      extended by
All Implemented Interfaces:
java.lang.Cloneable, java.util.Observer

public class KnightFish
extends AFish

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).

Mathias Ricken

Field Summary
Fields inherited from class
_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
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)
Make a new knight fish.

fishColor - color of the fish
Method Detail


protected void move()
Execute the movement part of a simulation step.

Specified by:
move in class AFish