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

import ch.epfl.maze.util.Direction;

import java.util.Set;

/**
 * A simple decision maker that continues forward if possible.
 *
 * @author Pacien TRAN-GIRARD
 */
public interface ForwardPicker extends BlindPicker {

    /**
     * Returns the current Direction the decision maker is walking toward.
     *
     * @return The current Direction
     */
    Direction getDirection();

    @Override
    default Direction pick(Set<Direction> choices) {
        if (choices.contains(this.getDirection()))
            return this.getDirection();
        else
            return FALLBACK_DIRECTION;
    }

}