-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
71 lines (55 loc) · 1.37 KB
/
Player.java
File metadata and controls
71 lines (55 loc) · 1.37 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import java.util.Random;
/**
* Abstract class Player - write a description of the class here
*
* @author (your name here)
* @version (version number or date here)
*/
public abstract class Player
{
private final PlayerInfo = new PlayerInfo(this);
protected static final Random RAND = new Random();
private int points = 0;
protected boolean lastDecision;
public int getPoints() {
return points;
}
public void incrementPoints(int amount) {
points += amount;
}
public boolean getLastDecision() {
return lastDecision;
}
public int getWinCount() {
return winCount;
}
public void incrementWinCount() {
winCount++;
}
public void reset() {
points = 0;
}
protected void setLastDecision(boolean decision) {
if(decision) {
yes++;
} else {
no++;
}
lastDecision = decision;
}
public int getYes() {
return yes;
}
public int getNo() {
return no;
}
public String toString() {
return getName();
}
public final boolean getDecision(Game game, int c) {
setLastDecision(doesJoin(game,c));
return lastDecision;
}
protected abstract boolean doesJoin(Game game, int c);
public abstract String getName();
}