diff options
Diffstat (limited to 'src/ch/epfl/maze/physical/DaedalusAware.java')
-rw-r--r-- | src/ch/epfl/maze/physical/DaedalusAware.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/ch/epfl/maze/physical/DaedalusAware.java b/src/ch/epfl/maze/physical/DaedalusAware.java new file mode 100644 index 0000000..16f20ee --- /dev/null +++ b/src/ch/epfl/maze/physical/DaedalusAware.java | |||
@@ -0,0 +1,54 @@ | |||
1 | package ch.epfl.maze.physical; | ||
2 | |||
3 | import ch.epfl.maze.util.Direction; | ||
4 | import ch.epfl.maze.util.Vector2D; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.EnumSet; | ||
8 | import java.util.Set; | ||
9 | |||
10 | /** | ||
11 | * @author Pacien TRAN-GIRARD | ||
12 | */ | ||
13 | public interface DaedalusAware { | ||
14 | |||
15 | /** | ||
16 | * Retrieves the next direction of the animal, by selecting one choice among | ||
17 | * the ones available from its position. | ||
18 | * <p> | ||
19 | * In this variation, the animal knows the world entirely. It can therefore | ||
20 | * use the position of other animals in the daedalus to hunt or to evade predators | ||
21 | * more effectively. | ||
22 | * | ||
23 | * @param choices The choices left to the animal at its current position (see | ||
24 | * {@link ch.epfl.maze.physical.World#getChoices(Vector2D) | ||
25 | * World.getChoices(Vector2D)}) | ||
26 | * @param daedalus The world in which the animal moves | ||
27 | * @return The next direction of the animal, chosen in {@code choices} | ||
28 | * @implNote Not abstract for compatibility purpose (in order not to break tests) | ||
29 | */ | ||
30 | default Direction move(Set<Direction> choices, Daedalus daedalus) { | ||
31 | return null; | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * Retrieves the next direction of the animal, by selecting one choice among | ||
36 | * the ones available from its position. | ||
37 | * <p> | ||
38 | * In this variation, the animal knows the world entirely. It can therefore | ||
39 | * use the position of other animals in the daedalus to hunt or to evade predators | ||
40 | * more effectively. | ||
41 | * | ||
42 | * @param choices The choices left to the animal at its current position (see | ||
43 | * {@link ch.epfl.maze.physical.World#getChoices(Vector2D) | ||
44 | * World.getChoices(Vector2D)}) | ||
45 | * @param daedalus The world in which the animal moves | ||
46 | * @return The next direction of the animal, chosen in {@code choices} | ||
47 | * @apiNote Not final for compatibility purpose (in order not to break tests) | ||
48 | * @deprecated Use @code{Direction move(Set<Direction> choices, Daedalus daedalus)} instead | ||
49 | */ | ||
50 | default Direction move(Direction[] choices, Daedalus daedalus) { | ||
51 | return this.move(EnumSet.copyOf(Arrays.asList(choices)), daedalus); | ||
52 | } | ||
53 | |||
54 | } | ||