diff options
Diffstat (limited to 'src/ch/epfl/maze/main/Program.java')
-rw-r--r-- | src/ch/epfl/maze/main/Program.java | 106 |
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 @@ | |||
1 | package ch.epfl.maze.main; | ||
2 | |||
3 | import ch.epfl.maze.graphics.Display; | ||
4 | import ch.epfl.maze.physical.Daedalus; | ||
5 | import ch.epfl.maze.physical.Maze; | ||
6 | import ch.epfl.maze.physical.pacman.Blinky; | ||
7 | import ch.epfl.maze.physical.pacman.Clyde; | ||
8 | import ch.epfl.maze.physical.pacman.Inky; | ||
9 | import ch.epfl.maze.physical.pacman.PacMan; | ||
10 | import ch.epfl.maze.physical.pacman.Pinky; | ||
11 | import ch.epfl.maze.physical.zoo.Bear; | ||
12 | import ch.epfl.maze.physical.zoo.Hamster; | ||
13 | import ch.epfl.maze.physical.zoo.Monkey; | ||
14 | import ch.epfl.maze.physical.zoo.Mouse; | ||
15 | import ch.epfl.maze.physical.zoo.Panda; | ||
16 | import ch.epfl.maze.simulation.DaedalusSimulation; | ||
17 | import ch.epfl.maze.simulation.MazeSimulation; | ||
18 | import ch.epfl.maze.simulation.Simulation; | ||
19 | import ch.epfl.maze.util.LabyrinthGenerator; | ||
20 | import ch.epfl.maze.util.Vector2D; | ||
21 | |||
22 | /** | ||
23 | * Mini-project main program that will run the simulations on a {@code Display}. | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | public 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 | } | ||