-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.java
109 lines (87 loc) · 1.48 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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**
* @author Maxx Boehme
* @version 1
*
* Class used to group Player information.
*/
import java.awt.Color;
public class Player {
private ComputerAI ai;
private boolean isAI;
private Token type;
private int wins;
private int draws;
private int losses;
private String name;
private Color c;
Player(Token t, boolean ai, Color c, String name){
type = t;
wins = draws = losses = 0;
this.c = c;
this.isAI = ai;
this.ai = new ComputerAI();
this.name = name;
}
Player(Token t, Color c, String name){
this(t, false, c, name);
}
Player(Token t, Color c){
this(t, false, c, null);
}
Player(){
this(Token.Empty, false, null, null);
}
public void setColor(Color c){
this.c = c;
}
public void setName(String name){
this.name = name;
}
public String getName(){
return this.name;
}
public Color getColor(){
return this.c;
}
public Token getType(){
return type;
}
public void setType(Token t){
type = t;
}
public void setAILevel(AILevel l){
this.ai.setLevel(l);
}
public void setAI(boolean ai){
this.isAI = ai;
}
public boolean isAI(){
return this.isAI;
}
public ComputerAI getAI(){
return ai;
}
public int getWins(){
return wins;
}
public int getLosses(){
return losses;
}
public int getDraws(){
return draws;
}
public void win(){
wins++;
}
public void lost(){
losses++;
}
public void draw(){
draws++;
}
public void clearScore() {
this.wins = 0;
this.losses = 0;
this.draws = 0;
}
}