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