-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.java
48 lines (36 loc) · 1.1 KB
/
Player.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
import java.util.List;
public class Player {
private String name;
private List<Combination> availableCombinations;
private int totalScore = 0;
private int bonusScore = 0;
private boolean bonusAwarded = false;
public Player(String name, List<Combination> availableCombinations) {
this.name = name;
this.availableCombinations = availableCombinations;
}
public String getName() {
return name;
}
public int getScore() {
return totalScore;
}
public void addPoints(int points) {
totalScore += points;
}
public void checkForBonus(int points) {
if (!bonusAwarded) {
bonusScore += points;
if (bonusScore >= 63) {
totalScore += 35;
bonusAwarded = true;
}
}
}
public List<Combination> getAvailableCombinations() {
return availableCombinations;
}
public void removeAvailableCombination(Combination combination) {
availableCombinations.remove(combination);
}
}