Can someone please explain to me what a straight-line distance heuristic would look like while solving the n-puzzle? How would you apply the straight line distance, say for a 8x8 puzzle? Here is an example puzzle:
7 3 4
5 _ 6
8 2 1
Let's recall basic geometry, it is well known that the shortest path between two points is a straight line.
So considering a 8-puzzle, the straight line distance between two tiles is the number of tiles to get from tile A to tile B whether is diagonal, horizontal or vertical line.
Considering the example in your question, let's call d(a,b) the straight line distance between tile a and b:
and so on.
We can now generalize that definition to the n-puzzle. Keep in mind that 3 steps are allowed diagonal, horizontal, vertical. In this case the heuristic is usually optimal.
Note: Remember the straight line definition between cities.