PathFinding.js icon indicating copy to clipboard operation
PathFinding.js copied to clipboard

can we run Pathfinding.js a bit more slowly?

Open ceid-ass opened this issue 9 years ago • 2 comments

Hi, I have a pathfinding problem to solve using A* algorithm and Best First Search and I am asked to present my answer step-by-step and then compare it to the answer Pathfinding.js would return if we ran the problem here.

The thing is that everything is being executed so quickly and I cannot understand the steps that are being done to compare them with the solutions I found running the algorithms myself.

Is it possible to add start/stop options so as to see algorithm executions step-by-step or maybe slow down time to make the steps appear more clearly?

ceid-ass avatar May 18 '16 14:05 ceid-ass

You can use the debuggers in the modern browsers. E.g. F12 in chrome.

imor avatar May 19 '16 21:05 imor

If you only want to show the solution maybe you can run the algorithm multiple times, and every time you can increase move up the path. Example:

  • Pre-run the algorithm say from block (0,0) to (8,8)
  • print/take note of all the returned blocks
  • In your presentation run the algorithm once for each pre-noted block e.g first run for (0, 0), (0,1) etc....

If you want to show the whole search, you can do the same but add a console.log for the neighbours it visits, then you can run it step by step maybe with a window.setInterval

netgfx avatar Jan 25 '21 16:01 netgfx