Answer the question
In order to leave comments, you need to log in
How to implement a pathfinding algorithm?
Several times on Habré slipped articles about the implementation of pathfinding algorithms. It became interesting for me, I decided to pump a little in js and build something (I do everything in html / js on divs, I know js, but more at the jQuery level). But here's the problem - in the process of implementation I understand that I don't know how best to do it. There were 2 ideas - to drive the search field into a two-dimensional array, and then go through it, creating an html output, then do the search / move in the array, again display the changes in html - it turns out double work.
Or the second option is to immediately display html blocks with auxiliary information (coordinates) and immediately perform the entire search in html - somehow crooked, in my opinion.
Tell me what decision to make, and I will also be glad if you advise any other ideas for practical js lessons.
Thank you.
Answer the question
In order to leave comments, you need to log in
Here is a very good illustration of how pathfinding works visually. And it can also be used to find paths. It already implements such algorithms as A* and others.
I once implemented a wave algorithm on js . Take a look, it might come in handy. Visually, you can see how the waves are built. The bypass itself as a whole is a single recursive function.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question