diff options
Diffstat (limited to 'src/ch/epfl/maze/physical/zoo/Bear.java')
-rw-r--r-- | src/ch/epfl/maze/physical/zoo/Bear.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/ch/epfl/maze/physical/zoo/Bear.java b/src/ch/epfl/maze/physical/zoo/Bear.java new file mode 100644 index 0000000..1a75932 --- /dev/null +++ b/src/ch/epfl/maze/physical/zoo/Bear.java | |||
@@ -0,0 +1,46 @@ | |||
1 | package ch.epfl.maze.physical.zoo; | ||
2 | |||
3 | import ch.epfl.maze.physical.Animal; | ||
4 | import ch.epfl.maze.util.Direction; | ||
5 | import ch.epfl.maze.util.Vector2D; | ||
6 | |||
7 | /** | ||
8 | * Bear A.I. that implements the Pledge Algorithm. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | public class Bear extends Animal { | ||
13 | |||
14 | /** | ||
15 | * Constructs a bear with a starting position. | ||
16 | * | ||
17 | * @param position | ||
18 | * Starting position of the bear in the labyrinth | ||
19 | */ | ||
20 | |||
21 | public Bear(Vector2D position) { | ||
22 | super(position); | ||
23 | // TODO | ||
24 | } | ||
25 | |||
26 | /** | ||
27 | * Moves according to the <i>Pledge Algorithm</i> : the bear tries to move | ||
28 | * towards a favorite direction until it hits a wall. In this case, it will | ||
29 | * turn right, put its paw on the left wall, count the number of times it | ||
30 | * turns right, and subtract to this the number of times it turns left. It | ||
31 | * will repeat the procedure when the counter comes to zero, or until it | ||
32 | * leaves the maze. | ||
33 | */ | ||
34 | |||
35 | @Override | ||
36 | public Direction move(Direction[] choices) { | ||
37 | // TODO | ||
38 | return Direction.NONE; | ||
39 | } | ||
40 | |||
41 | @Override | ||
42 | public Animal copy() { | ||
43 | // TODO | ||
44 | return null; | ||
45 | } | ||
46 | } | ||