1
\$\begingroup\$

This question already has an answer here:

I am trying to code a path finding function in c++ . It should work like that, you supply the start point (x1,y1) and the end point(x2,y2) and it returns a list of points for the shortest path.

image for illustration

Assume that i want to go from the red tile to the blue one, however the grey tiles can not be walked on (like walls) .

\$\endgroup\$

marked as duplicate by congusbongus, DMGregory, Josh Mar 30 '17 at 15:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ And what are you having trouble with? What path-finding algorithm to use? Or an issue with your existing code? \$\endgroup\$ – Tyyppi_77 Sep 24 '16 at 11:14
  • \$\begingroup\$ what algorithm should i use? \$\endgroup\$ – user2390934 Sep 24 '16 at 11:31
  • \$\begingroup\$ Then it seems that your question has already been answered (multiple times) already. Check out the link I posted above. \$\endgroup\$ – Tyyppi_77 Sep 24 '16 at 11:34