001 package model.fish; 002 003 import model.fish.display.RoundFishDisplay; 004 import model.RandNumGenerator; 005 006 import java.awt.*; 007 008 /** 009 * Class for a slow fish. 010 * 011 * @author Mathias G. Ricken 012 */ 013 public class SlowFish extends GenericFish { 014 /** 015 * Probability that this slow fish moves. 016 */ 017 private double _probOfMoving = 1.0f / 5.0f; 018 019 /** 020 * Create a new slow fish. 021 * 022 * @param fishColor color of the fish 023 */ 024 public SlowFish(Color fishColor) { 025 super(fishColor); 026 } 027 028 /** 029 * Carry out movement behavior for the fish. 030 */ 031 protected void move() { 032 if (RandNumGenerator.instance().nextDouble() < _probOfMoving) { 033 // slow fish attempts to move like super class 034 super.move(); 035 } 036 } 037 }