-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPeachesGame6.java
50 lines (30 loc) · 1.21 KB
/
PeachesGame6.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
import java.util.ArrayList;
import java.util.Random;
// Done by: Ikeobi Chigozie Daniel
// Demos who a Pit Finder finds pit and report back to home
public class PeachesGame6 {
public static void main(String[] args) throws InterruptedException {
World w = new World();
w.locations[0][0] = new Home(new Position(0, 0), "Home", new ArrayList<>(), createPeaches(50), w);
w.home = w.locations[0][0];
w.locations[2][2] = new PeachPit(new Position(2, 2), "Peach Pit", new ArrayList<>(), new ArrayList<>(), (Home) w.getHome());
PitFinder finder = new PitFinder(w, "Pit Finder", w.locations[0][1], new ArrayList<>(), 100, RGB.CYAN);
w.addPlayer(finder);
while(finder.pendingRevealHome.isEmpty()) {
finder.play();
System.out.println("******************************************");
}
while(!finder.pendingRevealHome.isEmpty()) {
finder.play();
System.out.println("******************************************");
}
}
private static ArrayList<Peach> createPeaches(int n) {
Random random = new Random();
ArrayList<Peach> peaches = new ArrayList<>();
for (int i = 0; i < n; i++) {
peaches.add(new Peach(random.nextInt(1+ 11)));
}
return peaches;
}
}