Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ManhattanDistance ¶
Return the Manhattan distance to the end point
Types ¶
type ExpandFunc ¶
A expand function returns all neighbors of a point
type HeuristicFunc ¶
A heuristic function returns an admissible estimate from one point to reach the end
type Route ¶
type Route struct {
Path []Point
}
A Route includes a set of ordered points as Path
func AStar ¶
func AStar(hill HillMap, expand ExpandFunc, cost CostFunc, heuristic HeuristicFunc) (Route, bool)
A* finds a path from start to goal.
hill is the map to be traversed, expand is an expansion function that returns all valid neighbors, cost is the cost function from point to another and the heuristic must be an admissible heuristic function in order to ensure the optimality of the results.
func BreadthFirstSearch ¶
func BreadthFirstSearch(hill HillMap, expand ExpandFunc) (Route, bool)
Breadth-First Search traverse the map from the end to get to the first 'a'
Click to show internal directories.
Click to hide internal directories.