-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLightCycleTest.java
96 lines (82 loc) · 2.07 KB
/
LightCycleTest.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
public class LightCycleTest extends LightCycle
{
public LightCycleTest (int x, int y,
ModelDisplay modelDisplayer)
{
// let the parent constructor handle it
super(x,y,modelDisplayer);
}
/** Constructor that takes the model display
* @param modelDisplay the thing that displays the model
*/
public static void main(String[] args) throws InterruptedException
{
final World w = new World();
final LightCycleTest lc = new LightCycleTest(213, 240, w);
final LightCycleTest lc1 = new LightCycleTest(423, 240, w);
boolean ran;
new Thread()
{
public void run()
{
if (World.State == World.STATE.LEVEL1)
{
lc.oForward(50);
}
else if (World.State == World.STATE.LEVEL2)
{
lc.oForward(25);
}
else if (World.State == World.STATE.LEVEL3)
{
lc.oForward(12);
}
else
{
lc.oForward(25);
}
}
}.start();
new Thread()
{
public void run()
{
if (World.State == World.STATE.LEVEL1)
{
lc1.oForward(50);
}
else if (World.State == World.STATE.LEVEL2)
{
lc1.oForward(25);
}
else if (World.State == World.STATE.LEVEL3)
{
lc1.oForward(12);
}
else
{
lc1.oForward(25);
}
}
}.start();
new Thread()
{
public void run()
{
while (true)
{
if (w.checkScore() != null)
w.updateScore(w.checkScore());
if (w.getScore1() == 11 || w.getScore2() == 10)
{
if (w.getScore1() == 11)
w.setWinner(1);
else if (w.getScore2() == 10)
w.setWinner(2);
World.State = World.STATE.DONE;
}
}
}
}.start();
}
}