-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorld.java
More file actions
61 lines (48 loc) · 1.92 KB
/
World.java
File metadata and controls
61 lines (48 loc) · 1.92 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
61
package agh.ics.oop;
import agh.ics.oop.model.*;
import org.w3c.dom.css.Rect;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class World {
public static void run(List<MoveDirection> directions) {
for (MoveDirection direction : directions) {
switch (direction) {
case FORWARD:
System.out.println("Zwierzak idzie prosto");
break;
case BACKWARD:
System.out.println("Zwierzak idzie do tyłu");
break;
case LEFT:
System.out.println("Zwierzak idzie w lewo");
break;
case RIGHT:
System.out.println("Zwierzak idzie w prawo");
break;
}
}
}
public static void main(String[] args) {
List<MoveDirection> directions = new ArrayList<>();
String[] args1 = {"f", "f","f","f","f","f","f","f","f"};
try {
List <Simulation> listOfSimulations = new ArrayList<>();
ConsoleMapDisplay listener = new ConsoleMapDisplay();
for(int i = 0; i < 20; i++) {
directions = OptionsParser.Parser(args1);
List<Vector2d> positions = List.of(new Vector2d(2,2), new Vector2d(3,4), new Vector2d(0,0));
GrassField map = new GrassField(10);
map.addListener(listener);
listOfSimulations.add(new Simulation(positions, directions, map));
}
SimulationEngine simulationEngine = new SimulationEngine(listOfSimulations);
simulationEngine.runAsyncInThreadPool();
simulationEngine.awaitSimulationsEnds();
System.out.println("koniec programu");
} catch (IllegalArgumentException | InterruptedException e){
e.printStackTrace();
}
}
}