diff options
Diffstat (limited to 'src/ch/epfl/maze/physical/zoo')
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/Bear.java | 64 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/Hamster.java | 56 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/Monkey.java | 54 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/Mouse.java | 54 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/Panda.java | 52 | ||||
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/SpaceInvader.java | 58 |
6 files changed, 163 insertions, 175 deletions
diff --git a/src/ch/epfl/maze/physical/zoo/Bear.java b/src/ch/epfl/maze/physical/zoo/Bear.java index 1a75932..5cccc08 100644 --- a/src/ch/epfl/maze/physical/zoo/Bear.java +++ b/src/ch/epfl/maze/physical/zoo/Bear.java | |||
@@ -6,41 +6,39 @@ import ch.epfl.maze.util.Vector2D; | |||
6 | 6 | ||
7 | /** | 7 | /** |
8 | * Bear A.I. that implements the Pledge Algorithm. | 8 | * Bear A.I. that implements the Pledge Algorithm. |
9 | * | ||
10 | */ | 9 | */ |
11 | 10 | ||
12 | public class Bear extends Animal { | 11 | public class Bear extends Animal { |
13 | 12 | ||
14 | /** | 13 | /** |
15 | * Constructs a bear with a starting position. | 14 | * Constructs a bear with a starting position. |
16 | * | 15 | * |
17 | * @param position | 16 | * @param position Starting position of the bear in the labyrinth |
18 | * Starting position of the bear in the labyrinth | 17 | */ |
19 | */ | 18 | |
20 | 19 | public Bear(Vector2D position) { | |
21 | public Bear(Vector2D position) { | 20 | super(position); |
22 | super(position); | 21 | // TODO |
23 | // TODO | 22 | } |
24 | } | 23 | |
25 | 24 | /** | |
26 | /** | 25 | * Moves according to the <i>Pledge Algorithm</i> : the bear tries to move |
27 | * Moves according to the <i>Pledge Algorithm</i> : the bear tries to move | 26 | * towards a favorite direction until it hits a wall. In this case, it will |
28 | * towards a favorite direction until it hits a wall. In this case, it will | 27 | * turn right, put its paw on the left wall, count the number of times it |
29 | * turn right, put its paw on the left wall, count the number of times it | 28 | * turns right, and subtract to this the number of times it turns left. It |
30 | * turns right, and subtract to this the number of times it turns left. It | 29 | * will repeat the procedure when the counter comes to zero, or until it |
31 | * will repeat the procedure when the counter comes to zero, or until it | 30 | * leaves the maze. |
32 | * leaves the maze. | 31 | */ |
33 | */ | 32 | |
34 | 33 | @Override | |
35 | @Override | 34 | public Direction move(Direction[] choices) { |
36 | public Direction move(Direction[] choices) { | 35 | // TODO |
37 | // TODO | 36 | return Direction.NONE; |
38 | return Direction.NONE; | 37 | } |
39 | } | 38 | |
40 | 39 | @Override | |
41 | @Override | 40 | public Animal copy() { |
42 | public Animal copy() { | 41 | // TODO |
43 | // TODO | 42 | return null; |
44 | return null; | 43 | } |
45 | } | ||
46 | } | 44 | } |
diff --git a/src/ch/epfl/maze/physical/zoo/Hamster.java b/src/ch/epfl/maze/physical/zoo/Hamster.java index a000daf..2a610f2 100644 --- a/src/ch/epfl/maze/physical/zoo/Hamster.java +++ b/src/ch/epfl/maze/physical/zoo/Hamster.java | |||
@@ -7,37 +7,35 @@ import ch.epfl.maze.util.Vector2D; | |||
7 | /** | 7 | /** |
8 | * Hamster A.I. that remembers the previous choice it has made and the dead ends | 8 | * Hamster A.I. that remembers the previous choice it has made and the dead ends |
9 | * it has already met. | 9 | * it has already met. |
10 | * | ||
11 | */ | 10 | */ |
12 | 11 | ||
13 | public class Hamster extends Animal { | 12 | public class Hamster extends Animal { |
14 | 13 | ||
15 | /** | 14 | /** |
16 | * Constructs a hamster with a starting position. | 15 | * Constructs a hamster with a starting position. |
17 | * | 16 | * |
18 | * @param position | 17 | * @param position Starting position of the hamster in the labyrinth |
19 | * Starting position of the hamster in the labyrinth | 18 | */ |
20 | */ | 19 | |
21 | 20 | public Hamster(Vector2D position) { | |
22 | public Hamster(Vector2D position) { | 21 | super(position); |
23 | super(position); | 22 | // TODO |
24 | // TODO | 23 | } |
25 | } | 24 | |
26 | 25 | /** | |
27 | /** | 26 | * Moves without retracing directly its steps and by avoiding the dead-ends |
28 | * Moves without retracing directly its steps and by avoiding the dead-ends | 27 | * it learns during its journey. |
29 | * it learns during its journey. | 28 | */ |
30 | */ | 29 | |
31 | 30 | @Override | |
32 | @Override | 31 | public Direction move(Direction[] choices) { |
33 | public Direction move(Direction[] choices) { | 32 | // TODO |
34 | // TODO | 33 | return Direction.NONE; |
35 | return Direction.NONE; | 34 | } |
36 | } | 35 | |
37 | 36 | @Override | |
38 | @Override | 37 | public Animal copy() { |
39 | public Animal copy() { | 38 | // TODO |
40 | // TODO | 39 | return null; |
41 | return null; | 40 | } |
42 | } | ||
43 | } | 41 | } |
diff --git a/src/ch/epfl/maze/physical/zoo/Monkey.java b/src/ch/epfl/maze/physical/zoo/Monkey.java index a9295b8..f0f9b2e 100644 --- a/src/ch/epfl/maze/physical/zoo/Monkey.java +++ b/src/ch/epfl/maze/physical/zoo/Monkey.java | |||
@@ -6,36 +6,34 @@ import ch.epfl.maze.util.Vector2D; | |||
6 | 6 | ||
7 | /** | 7 | /** |
8 | * Monkey A.I. that puts its hand on the left wall and follows it. | 8 | * Monkey A.I. that puts its hand on the left wall and follows it. |
9 | * | ||
10 | */ | 9 | */ |
11 | 10 | ||
12 | public class Monkey extends Animal { | 11 | public class Monkey extends Animal { |
13 | 12 | ||
14 | /** | 13 | /** |
15 | * Constructs a monkey with a starting position. | 14 | * Constructs a monkey with a starting position. |
16 | * | 15 | * |
17 | * @param position | 16 | * @param position Starting position of the monkey in the labyrinth |
18 | * Starting position of the monkey in the labyrinth | 17 | */ |
19 | */ | 18 | |
20 | 19 | public Monkey(Vector2D position) { | |
21 | public Monkey(Vector2D position) { | 20 | super(position); |
22 | super(position); | 21 | // TODO |
23 | // TODO | 22 | } |
24 | } | 23 | |
25 | 24 | /** | |
26 | /** | 25 | * Moves according to the relative left wall that the monkey has to follow. |
27 | * Moves according to the relative left wall that the monkey has to follow. | 26 | */ |
28 | */ | 27 | |
29 | 28 | @Override | |
30 | @Override | 29 | public Direction move(Direction[] choices) { |
31 | public Direction move(Direction[] choices) { | 30 | // TODO |
32 | // TODO | 31 | return Direction.NONE; |
33 | return Direction.NONE; | 32 | } |
34 | } | 33 | |
35 | 34 | @Override | |
36 | @Override | 35 | public Animal copy() { |
37 | public Animal copy() { | 36 | // TODO |
38 | // TODO | 37 | return null; |
39 | return null; | 38 | } |
40 | } | ||
41 | } | 39 | } |
diff --git a/src/ch/epfl/maze/physical/zoo/Mouse.java b/src/ch/epfl/maze/physical/zoo/Mouse.java index 17d8b5c..e5cb9ae 100644 --- a/src/ch/epfl/maze/physical/zoo/Mouse.java +++ b/src/ch/epfl/maze/physical/zoo/Mouse.java | |||
@@ -6,36 +6,34 @@ import ch.epfl.maze.util.Vector2D; | |||
6 | 6 | ||
7 | /** | 7 | /** |
8 | * Mouse A.I. that remembers only the previous choice it has made. | 8 | * Mouse A.I. that remembers only the previous choice it has made. |
9 | * | ||
10 | */ | 9 | */ |
11 | 10 | ||
12 | public class Mouse extends Animal { | 11 | public class Mouse extends Animal { |
13 | 12 | ||
14 | /** | 13 | /** |
15 | * Constructs a mouse with a starting position. | 14 | * Constructs a mouse with a starting position. |
16 | * | 15 | * |
17 | * @param position | 16 | * @param position Starting position of the mouse in the labyrinth |
18 | * Starting position of the mouse in the labyrinth | 17 | */ |
19 | */ | 18 | |
20 | 19 | public Mouse(Vector2D position) { | |
21 | public Mouse(Vector2D position) { | 20 | super(position); |
22 | super(position); | 21 | } |
23 | } | 22 | |
24 | 23 | /** | |
25 | /** | 24 | * Moves according to an improved version of a <i>random walk</i> : the |
26 | * Moves according to an improved version of a <i>random walk</i> : the | 25 | * mouse does not directly retrace its steps. |
27 | * mouse does not directly retrace its steps. | 26 | */ |
28 | */ | 27 | |
29 | 28 | @Override | |
30 | @Override | 29 | public Direction move(Direction[] choices) { |
31 | public Direction move(Direction[] choices) { | 30 | // TODO |
32 | // TODO | 31 | return Direction.NONE; |