diff options
Diffstat (limited to 'src/ch/epfl/maze/physical/Predator.java')
-rw-r--r-- | src/ch/epfl/maze/physical/Predator.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/ch/epfl/maze/physical/Predator.java b/src/ch/epfl/maze/physical/Predator.java new file mode 100644 index 0000000..5aa3be2 --- /dev/null +++ b/src/ch/epfl/maze/physical/Predator.java | |||
@@ -0,0 +1,59 @@ | |||
1 | package ch.epfl.maze.physical; | ||
2 | |||
3 | import ch.epfl.maze.util.Direction; | ||
4 | import ch.epfl.maze.util.Vector2D; | ||
5 | |||
6 | /** | ||
7 | * Predator that kills a prey when they meet with each other in the labyrinth. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | abstract public class Predator extends Animal { | ||
12 | |||
13 | /* constants relative to the Pac-Man game */ | ||
14 | public static final int SCATTER_DURATION = 14; | ||
15 | public static final int CHASE_DURATION = 40; | ||
16 | |||
17 | /** | ||
18 | * Constructs a predator with a specified position. | ||
19 | * | ||
20 | * @param position | ||
21 | * Position of the predator in the labyrinth | ||
22 | */ | ||
23 | |||
24 | public Predator(Vector2D position) { | ||
25 | super(position); | ||
26 | // TODO | ||
27 | } | ||
28 | |||
29 | /** | ||
30 | * Moves according to a <i>random walk</i>, used while not hunting in a | ||
31 | * {@code MazeSimulation}. | ||
32 | * | ||
33 | */ | ||
34 | |||
35 | @Override | ||
36 | public final Direction move(Direction[] choices) { | ||
37 | // TODO | ||
38 | return Direction.NONE; | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * Retrieves the next direction of the animal, by selecting one choice among | ||
43 | * the ones available from its position. | ||
44 | * <p> | ||
45 | * In this variation, the animal knows the world entirely. It can therefore | ||
46 | * use the position of other animals in the daedalus to hunt more | ||
47 | * effectively. | ||
48 | * | ||
49 | * @param choices | ||
50 | * The choices left to the animal at its current position (see | ||
51 | * {@link ch.epfl.maze.physical.World#getChoices(Vector2D) | ||
52 | * World.getChoices(Vector2D)}) | ||
53 | * @param daedalus | ||
54 | * The world in which the animal moves | ||
55 | * @return The next direction of the animal, chosen in {@code choices} | ||
56 | */ | ||
57 | |||
58 | abstract public Direction move(Direction[] choices, Daedalus daedalus); | ||
59 | } | ||