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