diff options
author | Pacien TRAN-GIRARD | 2015-11-24 15:23:36 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2015-11-24 15:37:19 +0100 |
commit | 33e497e3083c8446588244c1fa9e69f70af05664 (patch) | |
tree | 3ef665e3c9478f196bb6d61dd15a71c0a9919216 /src/ch/epfl/maze/physical/stragegies/reducer/BackwardReducer.java | |
parent | 6f2f503bbf75901273376c8c009a6b96886650c8 (diff) | |
download | maze-solver-33e497e3083c8446588244c1fa9e69f70af05664.tar.gz |
Refactor Mouse strategy
Diffstat (limited to 'src/ch/epfl/maze/physical/stragegies/reducer/BackwardReducer.java')
-rw-r--r-- | src/ch/epfl/maze/physical/stragegies/reducer/BackwardReducer.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/ch/epfl/maze/physical/stragegies/reducer/BackwardReducer.java b/src/ch/epfl/maze/physical/stragegies/reducer/BackwardReducer.java new file mode 100644 index 0000000..4ef2ff8 --- /dev/null +++ b/src/ch/epfl/maze/physical/stragegies/reducer/BackwardReducer.java | |||
@@ -0,0 +1,22 @@ | |||
1 | package ch.epfl.maze.physical.stragegies.reducer; | ||
2 | |||
3 | import ch.epfl.maze.util.Direction; | ||
4 | |||
5 | import java.util.Set; | ||
6 | |||
7 | /** | ||
8 | * A filter removing the possibility to go backward. | ||
9 | * | ||
10 | * @author Pacien TRAN-GIRARD | ||
11 | */ | ||
12 | public interface BackwardReducer extends BlindChoiceReducer { | ||
13 | |||
14 | Direction getDirection(); | ||
15 | |||
16 | @Override | ||
17 | default Set<Direction> reduce(Set<Direction> choices) { | ||
18 | choices.remove(this.getDirection().reverse()); | ||
19 | return choices; | ||
20 | } | ||
21 | |||
22 | } | ||