So the program generates a random grid of walls '#' and then a start position 'P' and end position 'D'. It then finds the shortest path from P to D and prints it onto the map in 'x' characters. The draw() and display functions can probably be ignored. I don't think that is where the problem is. That problem is fixed, but how to be more efficient?
The problem is, sometimes this is not solving grids which look like they should be solved in the 50 allowed iterations? I suspect the problem is in path() (lines 155 - 224). I try to solve this issue, but it's not going well. =/ Fixed.
Also, how can it be made more efficient? For example, I realize line 213 - 224 is expensive, but I don't know how on Earth I can do this without doing that double nested loop for every iteration of path? I would love to have 213 - 224 NOT in the program.
Thanks again for anyone who takes time to help me out with this! : )
[output]In function ‘void lowestpath()’:
239: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
You may benefit on using centinels, instead of checking if you are at the border.
> For example, I realize line 213 - 224 is expensive,
¿really? ¿how did you figure out that?
It's simply a traversal. You could store the position of the nodes to be changed.
> which look like they should be solved in the 50 allowed iterations
you are doing 49 iterations
Also, if destiny is next to the start position, you don't see that as shortest path.