P
P
PopeyetheSailor2013-06-11 01:01:44
JavaScript
PopeyetheSailor, 2013-06-11 01:01:44

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

3 answer(s)
E
Eugene Obrezkov, 2013-06-11
@PopeyetheSailor

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.

A
Andrey Apanasik, 2013-06-11
@Suvitruf

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.

O
overmes, 2013-06-13
@overmes

If your English is good, I can send links from the online AI course at the University of Berkeley. They tell very cool, there is A* in steps:
www.youtube.com/watch?feature=player_embedded&v=g0MJRpquEOk

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question