summaryrefslogtreecommitdiff
path: root/src/ch/epfl/maze/main/Program.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/ch/epfl/maze/main/Program.java')
-rw-r--r--src/ch/epfl/maze/main/Program.java106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/ch/epfl/maze/main/Program.java b/src/ch/epfl/maze/main/Program.java
new file mode 100644
index 0000000..a295ae2
--- /dev/null
+++ b/src/ch/epfl/maze/main/Program.java
@@ -0,0 +1,106 @@
1package ch.epfl.maze.main;
2
3import ch.epfl.maze.graphics.Display;
4import ch.epfl.maze.physical.Daedalus;
5import ch.epfl.maze.physical.Maze;
6import ch.epfl.maze.physical.pacman.Blinky;
7import ch.epfl.maze.physical.pacman.Clyde;
8import ch.epfl.maze.physical.pacman.Inky;
9import ch.epfl.maze.physical.pacman.PacMan;
10import ch.epfl.maze.physical.pacman.Pinky;
11import ch.epfl.maze.physical.zoo.Bear;
12import ch.epfl.maze.physical.zoo.Hamster;
13import ch.epfl.maze.physical.zoo.Monkey;
14import ch.epfl.maze.physical.zoo.Mouse;
15import ch.epfl.maze.physical.zoo.Panda;
16import ch.epfl.maze.simulation.DaedalusSimulation;
17import ch.epfl.maze.simulation.MazeSimulation;
18import ch.epfl.maze.simulation.Simulation;
19import ch.epfl.maze.util.LabyrinthGenerator;
20import ch.epfl.maze.util.Vector2D;
21
22/**
23 * Mini-project main program that will run the simulations on a {@code Display}.
24 *
25 */
26
27public class Program {
28
29 /**
30 * Runs one of the two available simulations
31 *
32 * @see #getMazeSimulation()
33 * @see #getDaedalusSimulation()
34 */
35
36 public static void main(String[] args) {
37 Simulation simulation;
38
39 simulation = getMazeSimulation();
40 //simulation = getDaedalusSimulation();
41
42 Display display = new Display(simulation);
43 display.run();
44 }
45
46 /**
47 * Creates a {@code MazeSimulation} with every animal implementations.
48 *
49 * @return A {@code MazeSimulation} to display
50 */
51
52 public static Simulation getMazeSimulation() {
53 int[][] labyrinth = LabyrinthGenerator.getMedium();
54 Maze m = new Maze(labyrinth);
55 Simulation simulation = new MazeSimulation(m);
56
57 // adds a Mouse
58 m.addAnimal(new Mouse(m.getStart()));
59
60 // adds a Monkey
61 m.addAnimal(new Monkey(m.getStart()));
62
63 // adds a Hamster
64 m.addAnimal(new Hamster(m.getStart()));
65
66 // adds a Bear (if this bonus is coded)
67 //m.addAnimal(new Bear(m.getStart()));
68
69 // adds a Panda
70 m.addAnimal(new Panda(m.getStart()));
71
72 return simulation;
73 }
74
75 /**
76 * Creates a {@code DaedalusSimulation} with every ghost implementation and
77 * 3 Pac-Mans.
78 *
79 * @return A {@code DaedalusSimulation} to display
80 */
81
82 public static Simulation getDaedalusSimulation() {
83 int[][] labyrinth = LabyrinthGenerator.getPacMan();
84 Daedalus d = new Daedalus(labyrinth);
85 Simulation simulation = new DaedalusSimulation(d);
86
87 // adds Pac-Mans
88 d.addPrey(new PacMan(new Vector2D(9, 15)));
89 d.addPrey(new PacMan(new Vector2D(10, 15)));
90 d.addPrey(new PacMan(new Vector2D(8, 15)));
91
92 // adds Blinky
93 d.addPredator(new Blinky(new Vector2D(17, 1)));
94
95 // adds Pinky
96 d.addPredator(new Pinky(new Vector2D(1, 1)));
97
98 // adds Inky
99 d.addPredator(new Inky(new Vector2D(17, 17)));
100
101 // adds Clyde
102 d.addPredator(new Clyde(new Vector2D(1, 17)));
103
104 return simulation;
105 }
106}