|
Artificial Intelligence Tools - Heuristic FunctionThe AI Tools package is an extension for Stencyl development environment. It is a general-purpose graphs toolset, which includes an implementation of A* pathfinding. Please see main page for more information. The heuristic function is used in the A* implementation to estimate the minimum cost to reach the goal from any point on the graph. A thorough discussion can be found here: (http://theory.stanford.edu/~amitp)[1]. The AI tools extension provides four options: Euclidean Norm is the default option. The distance between two nodes is calculated using the standard "distance formula" most of us learned in algebra class. ![]() Taxicab Norm computes the distance as the sum of "steps left/right" and "steps up/down". The name derives from how distances between buildings on a city street grid are calculated. ![]() Maximum Norm computes the distance as the greater of the horizontal distance (difference between columns) and vertical distance (difference between the rows). ![]() Dijkstra will always return 0. As per [1], this will guarantee the best path is found, at a cost of speed. ![]() Custom heuristics can be easily implemented by modifying the code. The function costEstimate can be found in the AStar class. |