0

I'm planning to use A* algorithm for path finding on a infinite grid with obstacles where only diagonal movements are allowed.But I'm not sure about which heuristic to use.I know that I cannot use Manhattan Distance.Can anyone suggest something ?

Arun
  • 55
  • 1
  • 7
  • If only diagonal movements are allowed then depending on the starting position, half of the grid is not be reachable. Is it correct? (e.g. bishop in chess) – Demplo Nov 07 '15 at 21:13
  • @Demplo Yep,you are right. – Arun Nov 07 '15 at 22:33
  • Then I would say Tom's answer works fine. Once you know if the target is reachable, you rotate 45 degrees and use Manhattan there. Assuming diagonal moves cost 1. – Demplo Nov 08 '15 at 00:43
  • @Demplo Got it,thanks! – Arun Nov 08 '15 at 01:36

1 Answers1

0

Think chess. Rotate 45 degrees. If only diagonal movement is allowed, in effect it's just like a grid with only orthogonal movement, but half the points on the original grid are unreachable.

Tom Zych
  • 13,329
  • 9
  • 36
  • 53
  • Yes,so what heuristic should I use so that it's admissible ? – Arun Nov 07 '15 at 16:49
  • @Arun: First see if the target is even reachable. Then transform the coordinates to an ordinary grid, and use whatever heuristic you would use for such a grid. – Tom Zych Nov 07 '15 at 16:52