-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSeaweed.java
38 lines (34 loc) · 843 Bytes
/
Seaweed.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Write a description of class Seaweed here.
*
* @author Dvin Amasi Hartoonian (K21049232), William Atta (K21097986)
* and Michael Seiranian (K20127931)
* @version 2022.02.27
*/
public class Seaweed extends Plant
{
private static final int MAX_GROWTH_LEVEL = 10;
/**
* Constructor for objects of class Seaweed
*/
public Seaweed(boolean randomGrowth, Field field, Location location)
{
super(field, location);
if(randomGrowth) {
setGrowthLevel(getRandom().nextInt(MAX_GROWTH_LEVEL));
}
else {
setGrowthLevel(0);
}
}
public void act(Weather weather, int step)
{
if(step % 5 == 0) {
incrementGrowth(weather);
}
}
public int getMaxGrowthLevel()
{
return MAX_GROWTH_LEVEL;
}
}