summaryrefslogtreecommitdiff
path: root/src/ch/epfl/maze/physical/stragegies/picker/ChoicePicker.java
blob: 76fe3eb9e82f2774c31b037b46e22d970c4a796b (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
package ch.epfl.maze.physical.stragegies.picker;

import ch.epfl.maze.physical.World;
import ch.epfl.maze.util.Direction;
import ch.epfl.maze.util.Vector2D;

import java.util.Set;

/**
 * A decision maker that can pick a Direction given multiple choices.
 *
 * @author Pacien TRAN-GIRARD
 */
public interface ChoicePicker {

    Direction FALLBACK_DIRECTION = Direction.NONE;

    /**
     * Retrieves the next direction of the animal, by selecting one choice among
     * the ones available from its position.
     *
     * @param choices The choices left to the animal at its current position (see
     *                {@link ch.epfl.maze.physical.World#getChoices(Vector2D)
     *                World.getChoices(Vector2D)})
     * @return The next direction of the animal, chosen in {@code choices}
     */
    Direction pick(Set<Direction> choices);

    /**
     * Retrieves the next direction of the animal, by selecting one choice among
     * the ones available from its position.
     * <p>
     * In this variation, the animal knows the world entirely. It can therefore
     * use the position of other animals in the daedalus to move more effectively.
     *
     * @param choices The choices left to the animal at its current position (see
     *                {@link ch.epfl.maze.physical.World#getChoices(Vector2D)
     *                World.getChoices(Vector2D)})
     * @param world   The world in which the animal moves
     * @return The next direction of the animal, chosen in {@code choices}
     */
    Direction pick(Set<Direction> choices, World world);

}