How can I find the most natural route (something a person can do) between two points, assuming I have an array of bytes, with each bit representing a square of a fixed size and indicating whether it is accessible or not? For example, assuming the array represents the following grid:
If the gray squares cannot intersect, I need an algorithm that finds the path indicated by the orange squares, and not the one represented by the brown squares.
, , , , . ( ). , , .
EDIT: , , "". , , , .
A * - , , "" .
, :
/* "Octile" heuristic */ int h(node n) { int dx = abs(n.x - goal.x); int dy = abs(n.y - goal.y); if (dx > dy) return 14 * dy + 10 * (dx - dy); else return 14 * dx + 10 * (dy - dx); }
: SW, SW, SW, W, W, W , SW, W, SW, W, SW, W ( ).
( ).
Amit ( *).
, A * pathfinding. , . .
. : , .
https://www.raywenderlich.com/4946/introduction-to-a-pathfinding
, - .
8 . , ( 0). ( 45, 90 135 , , ). ( N S, W E, SW NE ..). ( / , , ).
A * . , "" "".