My final project for ICS 211 was a fishing game in which two players took turns catching fish to achieve the highest score. The game ran over 12 months (12 rounds), and each player’s score was based on the size and type of fish they caught. At the beginning of the game, fish were added to a pond called “fishPond” to create an environment in which they could grow. Various types of fish were randomly generated in the pond based on the fish objects we created, and each fish had a different growth pattern.
Here is some code that shows how the fish grow:
protected void grow() {
Random ran = new Random();
double growthAmount = ran.nextDouble() * growthRate;
double newLength = this.length + growthAmount;
if (newLength > OAMA_MAX_LENGTH) {
throw new FishSizeException("'Oama has grow too large, it needs to level up!");
}
this.length = newLength;
this.weight = newLength * 2;
}