Package mazealgo.model.algorithms.search
Class SearchableMaze
java.lang.Object
mazealgo.model.algorithms.search.SearchableMaze
- All Implemented Interfaces:
ISearchable
Object Adapter that exposes a Maze as an ISearchable. Straight moves
(up/down/left/right) cost less than diagonal moves; a diagonal move
is only legal if at least one of the two orthogonal cells next to
the corner is also open, so the path cannot squeeze through a
pinhole between two walls.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAllPossibleStates(AState state) doubleOctile distance scaled to the straight/diagonal cost weights.
-
Constructor Details
-
SearchableMaze
-
-
Method Details
-
getStartState
- Specified by:
getStartStatein interfaceISearchable
-
getGoalState
- Specified by:
getGoalStatein interfaceISearchable
-
getAllPossibleStates
- Specified by:
getAllPossibleStatesin interfaceISearchable
-
heuristic
Octile distance scaled to the straight/diagonal cost weights. Equivalent to 15*min(|dr|,|dc|) + 10*(max-min), which is the exact optimal cost on an unobstructed grid - so it's admissible.- Specified by:
heuristicin interfaceISearchable
-