-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestWorld.java
More file actions
48 lines (37 loc) · 893 Bytes
/
TestWorld.java
File metadata and controls
48 lines (37 loc) · 893 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
47
48
import java.util.ArrayList;
import java.util.*;
public class TestWorld {
/**
* Main method
* @param args
*/
public static void main(String[] args) {
System.out.println("Wrap world? [Y/n]:");
Scanner choose = new Scanner(System.in);
Grid g = null;
if (choose.next().equals("Y")) {
//create wrapping world
g = new GridWrap(15, 25);
}
else {
//create bordered world
g = new GridBordered(15, 25);
}
//initialise species
Sp1 test = new Sp1(10,17, g);
Sp2 test2 = new Sp2(0,5, g);
// initialise grid
g.setCreature(test.getPos(), test.getDisp());
g.setCreature(test2.getPos(), test2.getDisp());
// loop to print every 0.5 seconds
while(true) {
g.printGrid();
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}