-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCell.java
More file actions
39 lines (31 loc) · 761 Bytes
/
Copy pathCell.java
File metadata and controls
39 lines (31 loc) · 761 Bytes
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
public class Cell {
private boolean isTaken = false;
private String player = " ";
private int pos;
public Cell(int pos) {
this.pos = pos;
}
public Cell() {};
//cloning constructor
public Cell(Cell another) {
isTaken = another.isTaken;
player = another.player;
}
public boolean getIsTaken() {
return isTaken;
}
public void setIsTaken(boolean s) {
isTaken = s;
}
public String getPlayer() {
return player;
}
public void setPlayer(String p) {
if (isTaken) {
throw new CellAlreadyTakenException("Already Taken");
}
player = p;
isTaken = true;
// TicTacToe.buttons.get(pos).setText(p);
}
}