-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGrass.java
56 lines (50 loc) · 1.33 KB
/
Grass.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* A simple model of grass.
* Grass age, spread, and die.
*
* @author Aymen berbache and Aleks
* @version 2022.02
*/
public class Grass extends Plant {
//The maximum age of grass.
private static final int MAX_AGE = 14;
//The food value of grass.
private static final int FOOD_VALUE = 8;
//The probability ratio at which grass spread
private static final double SPREADING_PROBABILITY = 0.07;
/**
* Create a new grass patch and place it on the field
* @param field The field currently occupied.
* @param location The location within the field.
*/
public Grass(Field field, Location location)
{
super(field, location);
}
/**
* @param field The simulation field.
* @param location Location to create the new grass.
* @return The new grass object
*/
protected Plant newPlantObject(Field field, Location location) {
return new Grass(field, location);
}
/**
* @return The grass' food value
*/
protected int getFOOD_VALUE() {
return FOOD_VALUE;
}
/**
* @return The grass maximum age
*/
protected int getMAX_AGE() {
return MAX_AGE;
}
/**
* @return The grass spreading probability
*/
protected double getSPREADING_PROBABILITY() {
return SPREADING_PROBABILITY;
}
}