-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtimelimit()
More file actions
46 lines (45 loc) · 977 Bytes
/
timelimit()
File metadata and controls
46 lines (45 loc) · 977 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
40
41
42
43
44
45
46
public void timelimit() {
int count = 0;
if (turn % 2 == 0) {
for (int i = 10; i >= 1; i--)
if (turn % 2 == 0) {
try {
Thread.sleep(1000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
count++;
label_0.setText("제한시간 "+(10-count)+"초 남았습니다.");
}
if (count == 10) {
add(result);
result.setText("시간초과 P2 승리");
omok = new int[SIZE][SIZE];
turn = 0;
win = 0;
count = 0;
}
}
else if (turn % 2 == 1) {
for (int i = 10; i >= 1; i--)
if (turn % 2 == 1) {
try {
Thread.sleep(1000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
count++;
label_0.setText("제한시간 "+(10-count)+"초 남았습니다.");
}
if (count == 10) {
add(result);
result.setText("시간초과 P1 승리");
omok = new int[SIZE][SIZE];
turn = 0;
win = 0;
count = 0;
}
}
}