diff options
author | Pacien TRAN-GIRARD | 2015-11-21 10:36:18 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2015-11-21 10:36:18 +0100 |
commit | 655ac88f4e73b2df532a451aedf5a561ea1b0d2c (patch) | |
tree | ef6f914a465575f313e2b280bf0639d87a4cbd58 /src/ch/epfl/maze/physical/Animal.java | |
parent | 56279eb59ccdea48b18daa027a5095d861b4e2f4 (diff) | |
download | maze-solver-655ac88f4e73b2df532a451aedf5a561ea1b0d2c.tar.gz |
Import project structure
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 | } | ||