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