-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestInstant.java
More file actions
60 lines (53 loc) · 2.46 KB
/
Copy pathTestInstant.java
File metadata and controls
60 lines (53 loc) · 2.46 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
import java.time.Instant;
public class TestInstant {
//Action-invoking range
final static double DELTA_X = 15;
final static double DELTA_Y = 15;
public static void main(String[] args) throws InterruptedException {
Counter counter = new Counter(10);
counter.openCounter();
counter.changeReference(Instant.now());
for (int i = 0; i <= 20; i++) {
Thread.sleep(200);
counter.changeTime(Instant.now());
System.out.println(counter.getT());
}
}
private static void drawTimerForPlayer1(int t) throws IllegalArgumentException{
StdDraw.picture(437,216,".\\Timer\\black.png");
if (t >= 600 || t < 0) throw new IllegalArgumentException("Illegal time player1");
// (538,213) (563,207) (591,213) (627,213)
else if (t == 0) {
StdDraw.picture(538,213,".\\Timer\\Arabic\\red0.png");
StdDraw.picture(563,207,".\\Timer\\Arabic\\ddot.png");
StdDraw.picture(591,213,".\\Timer\\Arabic\\red0.png");
StdDraw.picture(627,213,".\\Timer\\Arabic\\red0.png");
}
else {
int min = t/60; int s = t%60;
int s1 = s/10; int s2 = s%10;
StdDraw.picture(538,213,".\\Timer\\Arabic\\" + min + ".png");
StdDraw.picture(563,207,".\\Timer\\Arabic\\ddot.png");
StdDraw.picture(591,213,".\\Timer\\Arabic\\" + s1 + ".png");
StdDraw.picture(627,213,".\\Timer\\Arabic\\" + s2 + ".png");
}
}
private static void drawTimerForPlayer2(int t){
StdDraw.picture(434,291,".\\Timer\\white.png");
if (t >= 600 || t < 0) throw new IllegalArgumentException("Illegal time player1");
else if (t == 0) {
StdDraw.picture(538,286,".\\Timer\\Arabic\\red0.png");
StdDraw.picture(563,280,".\\Timer\\Arabic\\ddot.png");
StdDraw.picture(591,286,".\\Timer\\Arabic\\red0.png");
StdDraw.picture(627,286,".\\Timer\\Arabic\\red0.png");
}
else {
int min = t/60; int s = t%60;
int s1 = s/10; int s2 = s%10;
StdDraw.picture(538,286,".\\Timer\\Arabic\\" + min + ".png");
StdDraw.picture(563,280,".\\Timer\\Arabic\\ddot.png");
StdDraw.picture(591,286,".\\Timer\\Arabic\\" + s1 + ".png");
StdDraw.picture(627,286,".\\Timer\\Arabic\\" + s2 + ".png");
}
}
}