summaryrefslogtreecommitdiff
path: root/src/ch/epfl/maze/physical
diff options
context:
space:
mode:
Diffstat (limited to 'src/ch/epfl/maze/physical')
-rw-r--r--src/ch/epfl/maze/physical/Animal.java104
-rw-r--r--src/ch/epfl/maze/physical/Daedalus.java238
-rw-r--r--src/ch/epfl/maze/physical/Maze.java105
-rw-r--r--src/ch/epfl/maze/physical/Predator.java89
-rw-r--r--src/ch/epfl/maze/physical/Prey.java81
-rw-r--r--src/ch/epfl/maze/physical/World.java259
-rw-r--r--src/ch/epfl/maze/physical/pacman/Blinky.java40
-rw-r--r--src/ch/epfl/maze/physical/pacman/Clyde.java40
-rw-r--r--src/ch/epfl/maze/physical/pacman/Inky.java40
-rw-r--r--src/ch/epfl/maze/physical/pacman/PacMan.java29
-rw-r--r--src/ch/epfl/maze/physical/pacman/Pinky.java40
-rw-r--r--src/ch/epfl/maze/physical/zoo/Bear.java64
-rw-r--r--src/ch/epfl/maze/physical/zoo/Hamster.java56
-rw-r--r--src/ch/epfl/maze/physical/zoo/Monkey.java54
-rw-r--r--src/ch/epfl/maze/physical/zoo/Mouse.java54
-rw-r--r--src/ch/epfl/maze/physical/zoo/Panda.java52
-rw-r--r--src/ch/epfl/maze/physical/zoo/SpaceInvader.java58
17 files changed, 674 insertions, 729 deletions
diff --git a/src/ch/epfl/maze/physical/Animal.java b/src/ch/epfl/maze/physical/Animal.java
index 8749f61..ebe389f 100644
--- a/src/ch/epfl/maze/physical/Animal.java
+++ b/src/ch/epfl/maze/physical/Animal.java
@@ -6,72 +6,68 @@ import ch.epfl.maze.util.Vector2D;
6/** 6/**
7 * Animal inside a {@code World} that can move depending on the available 7 * Animal inside a {@code World} that can move depending on the available
8 * choices it has at its position. 8 * choices it has at its position.
9 *
10 */ 9 */
11 10
12abstract public class Animal { 11abstract public class Animal {
13 12
14 /** 13 /**
15 * Constructs an animal with a specified position. 14 * Constructs an animal with a specified position.
16 * 15 *
17 * @param position 16 * @param position Position of the animal in the labyrinth
18 * Position of the animal in the labyrinth 17 */
19 */
20 18
21 public Animal(Vector2D position) { 19 public Animal(Vector2D position) {
22 // TODO 20 // TODO
23 } 21 }
24 22
25 /** 23 /**
26 * Retrieves the next direction of the animal, by selecting one choice among 24 * Retrieves the next direction of the animal, by selecting one choice among
27 * the ones available from its position. 25 * the ones available from its position.
28 * 26 *
29 * @param choices 27 * @param choices The choices left to the animal at its current position (see
30 * The choices left to the animal at its current position (see 28 * {@link ch.epfl.maze.physical.World#getChoices(Vector2D)
31 * {@link ch.epfl.maze.physical.World#getChoices(Vector2D) 29 * World.getChoices(Vector2D)})
32 * World.getChoices(Vector2D)}) 30 * @return The next direction of the animal, chosen in {@code choices}
33 * @return The next direction of the animal, chosen in {@code choices} 31 */
34 */
35 32
36 abstract public Direction move(Direction[] choices); 33 abstract public Direction move(Direction[] choices);
37 34
38 /** 35 /**
39 * Updates the animal position with a direction. 36 * Updates the animal position with a direction.
40 * <p> 37 * <p>
41 * <b>Note</b> : Do not call this function in {@code move(Direction[] 38 * <b>Note</b> : Do not call this function in {@code move(Direction[]
42 * choices)} ! 39 * choices)} !
43 * 40 *
44 * @param dir 41 * @param dir Direction that the animal has taken
45 * Direction that the animal has taken 42 */
46 */
47 43
48 public final void update(Direction dir) { 44 public final void update(Direction dir) {
49 // TODO 45 // TODO
50 } 46 }
51 47
52 /** 48 /**
53 * Sets new position for Animal. 49 * Sets new position for Animal.
54 * <p> 50 * <p>
55 * <b>Note</b> : Do not call this function in {@code move(Direction[] 51 * <b>Note</b> : Do not call this function in {@code move(Direction[]
56 * choices)} ! 52 * choices)} !
57 * 53 *
58 * @param position 54 * @param position
59 */ 55 */
60 56
61 public final void setPosition(Vector2D position) { 57 public final void setPosition(Vector2D position) {
62 // TODO 58 // TODO
63 } 59 }
64 60
65 /** 61 /**
66 * Returns position vector of animal. 62 * Returns position vector of animal.
67 * 63 *
68 * @return Current position of animal. 64 * @return Current position of animal.
69 */ 65 */
70 66
71 public final Vector2D getPosition() { 67 public final Vector2D getPosition() {
72 // TODO 68 // TODO
73 return null; 69 return null;
74 } 70 }
75 71
76 abstract public Animal copy(); 72 abstract public Animal copy();
77} 73}
diff --git a/src/ch/epfl/maze/physical/Daedalus.java b/src/ch/epfl/maze/physical/Daedalus.java
index 329ab92..2edad7b 100644
--- a/src/ch/epfl/maze/physical/Daedalus.java
+++ b/src/ch/epfl/maze/physical/Daedalus.java
@@ -6,131 +6,123 @@ import java.util.List;
6/** 6/**
7 * Daedalus in which predators hunt preys. Once a prey has been caught by a 7 * Daedalus in which predators hunt preys. Once a prey has been caught by a
8 * predator, it will be removed from the daedalus. 8 * predator, it will be removed from the daedalus.
9 *
10 */ 9 */
11 10
12public final class Daedalus extends World { 11public final class Daedalus extends World {
13 12
14 /** 13 /**
15 * Constructs a Daedalus with a labyrinth structure 14 * Constructs a Daedalus with a labyrinth structure
16 * 15 *
17 * @param labyrinth 16 * @param labyrinth Structure of the labyrinth, an NxM array of tiles
18 * Structure of the labyrinth, an NxM array of tiles 17 */
19 */ 18
20 19 public Daedalus(int[][] labyrinth) {
21 public Daedalus(int[][] labyrinth) { 20 super(labyrinth);
22 super(labyrinth); 21 // TODO
23 // TODO 22 }
24 } 23
25 24 @Override
26 @Override 25 public boolean isSolved() {
27 public boolean isSolved() { 26 // TODO
28 // TODO 27 return false;
29 return false; 28 }
30 } 29
31 30 /**
32 /** 31 * Adds a predator to the daedalus.
33 * Adds a predator to the daedalus. 32 *
34 * 33 * @param p The predator to add
35 * @param p 34 */
36 * The predator to add 35
37 */ 36 public void addPredator(Predator p) {
38 37 // TODO
39 public void addPredator(Predator p) { 38 }
40 // TODO 39
41 } 40 /**
42 41 * Adds a prey to the daedalus.
43 /** 42 *
44 * Adds a prey to the daedalus. 43 * @param p The prey to add
45 * 44 */
46 * @param p 45
47 * The prey to add 46 public void addPrey(Prey p) {
48 */ 47 // TODO
49 48 }
50 public void addPrey(Prey p) { 49
51 // TODO 50 /**
52 } 51 * Removes a predator from the daedalus.
53 52 *
54 /** 53 * @param p The predator to remove
55 * Removes a predator from the daedalus. 54 */
56 * 55
57 * @param p 56 public void removePredator(Predator p) {
58 * The predator to remove 57 // TODO
59 */ 58 }
60 59
61 public void removePredator(Predator p) { 60 /**
62 // TODO 61 * Removes a prey from the daedalus.
63 } 62 *
64 63 * @param p The prey to remove
65 /**