diff options
author | Pacien TRAN-GIRARD | 2015-11-24 16:59:05 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2015-11-24 16:59:05 +0100 |
commit | 96932b453e3f2fa1cfb45e79aca49e72d7b8d10f (patch) | |
tree | e9aef469ceabcc118966ab89953a51ea0132b81f /src/ch/epfl/maze/physical/stragegies/picker | |
parent | 3f5c3d91a084233cfc77635697b3c537adbced74 (diff) | |
download | maze-solver-96932b453e3f2fa1cfb45e79aca49e72d7b8d10f.tar.gz |
Update Monkey A.I. for open positions
Diffstat (limited to 'src/ch/epfl/maze/physical/stragegies/picker')
-rw-r--r-- | src/ch/epfl/maze/physical/stragegies/picker/ForwardPicker.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/ch/epfl/maze/physical/stragegies/picker/ForwardPicker.java b/src/ch/epfl/maze/physical/stragegies/picker/ForwardPicker.java new file mode 100644 index 0000000..b7a44f8 --- /dev/null +++ b/src/ch/epfl/maze/physical/stragegies/picker/ForwardPicker.java | |||
@@ -0,0 +1,29 @@ | |||
1 | package ch.epfl.maze.physical.stragegies.picker; | ||
2 | |||
3 | import ch.epfl.maze.util.Direction; | ||
4 | |||
5 | import java.util.Set; | ||
6 | |||
7 | /** | ||
8 | * A simple decision maker that continues forward if possible. | ||
9 | * | ||
10 | * @author Pacien TRAN-GIRARD | ||
11 | */ | ||
12 | public interface ForwardPicker extends BlindPicker { | ||
13 | |||
14 | /** | ||
15 | * Returns the current Direction the decision maker is walking toward. | ||
16 | * | ||
17 | * @return The current Direction | ||
18 | */ | ||
19 | Direction getDirection(); | ||
20 | |||
21 | @Override | ||
22 | default Direction pick(Set<Direction> choices) { | ||
23 | if (choices.contains(this.getDirection())) | ||
24 | return this.getDirection(); | ||
25 | else | ||
26 | return FALLBACK_DIRECTION; | ||
27 | } | ||
28 | |||
29 | } | ||