diff options
Diffstat (limited to 'src/ch/epfl/maze/physical/Animal.java')
-rw-r--r-- | src/ch/epfl/maze/physical/Animal.java | 77 |
1 files changed, 77 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 | } | ||