From 96932b453e3f2fa1cfb45e79aca49e72d7b8d10f Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Tue, 24 Nov 2015 16:59:05 +0100 Subject: Update Monkey A.I. for open positions --- .../physical/stragegies/picker/ForwardPicker.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/ch/epfl/maze/physical/stragegies/picker/ForwardPicker.java (limited to 'src/ch/epfl/maze/physical/stragegies/picker') 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 @@ +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 choices) { + if (choices.contains(this.getDirection())) + return this.getDirection(); + else + return FALLBACK_DIRECTION; + } + +} -- cgit v1.2.3