diff options
Diffstat (limited to 'src/ch/epfl/maze/physical')
-rw-r--r-- | src/ch/epfl/maze/physical/Animal.java | 77 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/Daedalus.java | 136 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/Maze.java | 79 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/Predator.java | 59 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/Prey.java | 55 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/World.java | 146 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/pacman/Blinky.java | 39 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/pacman/Clyde.java | 40 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/pacman/Inky.java | 40 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/pacman/PacMan.java | 32 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/pacman/Pinky.java | 39 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/Bear.java | 46 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/Hamster.java | 43 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/Monkey.java | 41 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/Mouse.java | 41 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/Panda.java | 43 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/SpaceInvader.java | 52 |
17 files changed, 1008 insertions, 0 deletions
diff --git a/src/ch/epfl/maze/physical/Animal.java b/src/ch/epfl/maze/physical/Animal.java new file mode 100644 index 0000000..8749f61 --- /dev/null +++ b/src/ch/epfl/maze/physical/Animal.java | |||
@@ -0,0 +1,77 @@ | |||
1 | package ch.epfl.maze.physical; | ||
2 | |||
3 | import ch.epfl.maze.util.Direction; | ||
4 | import ch.epfl.maze.util.Vector2D; | ||
5 | |||
6 | /** | ||
7 | * Animal inside a {@code World} that can move depending on the available | ||
8 | * choices it has at its position. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | abstract public class Animal { | ||
13 | |||
14 | /** | ||
15 | * Constructs an animal with a specified position. | ||
16 | * | ||
17 | * @param position | ||
18 | * Position of the animal in the labyrinth | ||
19 | */ | ||
20 | |||
21 | public Animal(Vector2D position) { | ||
22 | // TODO | ||
23 | } | ||
24 | |||
25 | /** | ||
26 | * Retrieves the next direction of the animal, by selecting one choice among | ||
27 | * the ones available from its position. | ||
28 | * | ||
29 | * @param choices | ||
30 | * The choices left to the animal at its current position (see | ||
31 | * {@link ch.epfl.maze.physical.World#getChoices(Vector2D) | ||
32 | * World.getChoices(Vector2D)}) | ||
33 | * @return The next direction of the animal, chosen in {@code choices} | ||
34 | */ | ||
35 | |||
36 | abstract public Direction move(Direction[] choices); | ||
37 | |||
38 | /** | ||
39 | * Updates the animal position with a direction. | ||
40 | * <p> | ||
41 | * <b>Note</b> : Do not call this function in {@code move(Direction[] | ||
42 | * choices)} ! | ||
43 | * | ||
44 | * @param dir | ||
45 | * Direction that the animal has taken | ||
46 | */ | ||
47 | |||
48 | public final void update(Direction dir) { | ||
49 | // TODO | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * Sets new position for Animal. | ||
54 | * <p> | ||
55 | * <b>Note</b> : Do not call this function in {@code move(Direction[] | ||
56 | * choices)} ! | ||
57 | * | ||
58 | * @param position | ||
59 | */ | ||
60 | |||
61 | public final void setPosition(Vector2D position) { | ||
62 | // TODO | ||
63 | } | ||
64 | |||
65 | /** | ||
66 | * Returns position vector of animal. | ||
67 | * | ||
68 | * @return Current position of animal. | ||
69 | */ | ||
70 | |||
71 | public final Vector2D getPosition() { | ||
72 | // TODO | ||
73 | return null; | ||
74 | } | ||
75 | |||
76 | abstract public Animal copy(); | ||
77 | } | ||
diff --git a/src/ch/epfl/maze/physical/Daedalus.java b/src/ch/epfl/maze/physical/Daedalus.java new file mode 100644 index 0000000..329ab92 --- /dev/null +++ b/src/ch/epfl/maze/physical/Daedalus.java | |||
@@ -0,0 +1,136 @@ | |||
1 | package ch.epfl.maze.physical; | ||
2 | |||
3 | import java.util.ArrayList; | ||
4 | import java.util.List; | ||
5 | |||
6 | /** | ||
7 | * Daedalus in which predators hunt preys. Once a prey has been caught by a | ||
8 | * predator, it will be removed from the daedalus. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | public final class Daedalus extends World { | ||
13 | |||
14 | /** | ||
15 | * Constructs a Daedalus with a labyrinth structure | ||
16 | * | ||
17 | * @param labyrinth | ||
18 | * Structure of the labyrinth, an NxM array of tiles | ||
19 | */ | ||
20 | |||
21 | public Daedalus(int[][] labyrinth) { | ||
22 | super(labyrinth); | ||
23 | // TODO | ||
24 | } | ||
25 | |||
26 | @Override | ||
27 | public boolean isSolved() { | ||
28 | // TODO | ||
29 | return false; | ||
30 | } | ||
31 | |||
32 | /** | ||
33 | * Adds a predator to the daedalus. | ||
34 | * | ||
35 | * @param p | ||
36 | * The predator to add | ||
37 | */ | ||
38 | |||
39 | public void addPredator(Predator p) { | ||
40 | // TODO | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * Adds a prey to the daedalus. | ||
45 | * | ||
46 | * @param p | ||
47 | * The prey to add | ||
48 | */ | ||
49 | |||
50 | public void addPrey(Prey p) { | ||
51 | // TODO | ||
52 | } | ||
53 | |||
54 | /** | ||
55 | * Removes a predator from the daedalus. | ||
56 | * | ||
57 | * @param p | ||
58 | * The predator to remove | ||
59 | */ | ||
60 | |||
61 | public void removePredator(Predator p) { | ||
62 | // TODO | ||
63 | } | ||
64 | |||
65 | /** | ||
66 | * Removes a prey from the daedalus. | ||
67 | * | ||
68 | * @param p | ||
69 | * The prey to remove | ||
70 | */ | ||
71 | |||
72 | public void removePrey(Prey p) { | ||
73 | // TODO | ||
74 | } | ||
75 | |||
76 | @Override | ||
77 | public List<Animal> getAnimals() { | ||
78 | // TODO | ||
79 | return null; | ||
80 | } | ||
81 | |||
82 | /** | ||
83 | * Returns a copy of the list of all current predators in the daedalus. | ||
84 | * | ||
85 | * @return A list of all predators in the daedalus | ||
86 | */ | ||
87 | |||
88 | public List<Predator> getPredators() { | ||
89 | // TODO | ||
90 | return new ArrayList<Predator>(); | ||
91 | } | ||
92 | |||
93 | /** | ||
94 | * Returns a copy of the list of all current preys in the daedalus. | ||
95 | * | ||
96 | * @return A list of all preys in the daedalus | ||
97 | */ | ||
98 | |||
99 | public List<Prey> getPreys() { | ||
100 | // TODO | ||
101 | return new ArrayList<Prey>(); | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * Determines if the daedalus contains a predator. | ||
106 | * | ||
107 | * @param p | ||
108 | * The predator in question | ||
109 | * @return <b>true</b> if the predator belongs to the world, <b>false</b> | ||
110 | * otherwise. | ||
111 | */ | ||
112 | |||
113 | public boolean hasPredator(Predator p) { | ||
114 | // TODO | ||
115 | return false; | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * Determines if the daedalus contains a prey. | ||
120 | * | ||
121 | * @param p | ||
122 | * The prey in question | ||
123 | * @return <b>true</b> if the prey belongs to the world, <b>false</b> | ||
124 | * otherwise. | ||
125 | */ | ||
126 | |||
127 | public boolean hasPrey(Prey p) { | ||
128 | // TODO | ||
129 | return false; | ||
130 | } | ||