-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cell.java
51 lines (40 loc) · 891 Bytes
/
Cell.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
public class Cell {
private int number;
private boolean isMine;
private boolean isDug;
private boolean isFlagged;
public Cell() {
this.number = 0;
this.isMine = false;
this.isDug = false;
this.isFlagged = false;
}
public void fillMine() {
this.isMine = true;
}
public boolean isMine() {
return this.isMine;
}
public void dug() {
this.isDug = true;
}
public boolean isDug() {
return this.isDug;
}
public boolean flagging() {
if (this.isDug) {
return false;
}
this.isFlagged = !this.isFlagged;
return true;
}
public boolean isFlagged() {
return this.isFlagged;
}
public void setNumber(int n) {
this.number = n;
}
public int getNumber() {
return this.number;
}
}