Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3rd Time Running Path Finder, crashes #31

Closed
ccarterc opened this issue May 23, 2013 · 2 comments
Closed

3rd Time Running Path Finder, crashes #31

ccarterc opened this issue May 23, 2013 · 2 comments

Comments

@ccarterc
Copy link

Tried with and without diagonal option defined and same result. When I run the pathfinder method it works twice returning expected results in an array. When I run it for a third time, it returns an empty object. Strange. http://jsfiddle.net/ccarterc1984/5ABHL/

@qiao
Copy link
Owner

qiao commented May 23, 2013

In your code, the gridBackup is dirty when the findThePath function is called for the second time. So the subsequent calls to findThePath will not return the correct answer.

To correct it, you should make a clone of the grid every time before the pathfinding. See Line 17 of my modified version: http://jsfiddle.net/UYyQM/1/

@ccarterc
Copy link
Author

Oh excellent! I don't know why that works, but it does. Much thanks to
you for the help. :) You've offered up a great script.

On Wed, May 22, 2013 at 6:05 PM, Xueqiao Xu notifications@github.comwrote:

In your code, the gridBackup is dirty when the findThePath function is
called for the second time. So the subsequent calls to findThePath will
not return the correct answer.

To correct it, you should make a clone of the grid every time before
the pathfinding. See Line 17 of my modified version:
http://jsfiddle.net/UYyQM/1/


Reply to this email directly or view it on GitHubhttps://github.com//issues/31#issuecomment-18317919
.

@qiao qiao closed this as completed May 23, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants