-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
74 lines (58 loc) · 1.49 KB
/
Player.java
File metadata and controls
74 lines (58 loc) · 1.49 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
72
73
74
package pictionary3;
public class Player {
private int points;
private String answer;
private String answerModified; //modified to take out all chars except letters and change to lowercase
private String guess;
private String name;
private boolean isTurn;
public Player(String defaultName) {
points = 0;
answer = "";
guess = "";
isTurn = false;
name = defaultName;
}
public String getName() {
return name;
}
public boolean getIsTurn() {
return isTurn;
}
public int getPoints() {
return points;
}
public String getAnswer() {
return answer;
}
public String getAnswerModified() {
return answerModified;
}
public String getGuess() {
return guess;
}
public void addPoint() {
points++;
}
public void setName(String newName) {
name = newName;
}
public void setIsTurn(boolean turn) {
isTurn = turn;
}
public void setPoints(int newPoints) {
points = newPoints;
}
//sets answer and modified answer
public void setAnswer(String newDrawingName) {
//remove everything except letters from the drawingName and change to lower case
answer = newDrawingName;
newDrawingName = newDrawingName.replaceAll("[^a-zA-Z]", "").toLowerCase();
answerModified = newDrawingName;
}
public void setGuess(String newGuess) {
//remove everything except letters from the guess and change to lower case
newGuess = newGuess.replaceAll("[^a-zA-Z]", "").toLowerCase();
guess = newGuess;
}
}