Path Finding Algorithms (A*, Dijkstra, Bi-Directional BFS)
Why Stack Overflow recommends it
Stack Overflow users link it when explaining how A* and Dijkstra search a grid, especially around obstacles and walls.
Recommended by 1 people across 1 different months, 2011 to 2012.
What it is
A short Pygame demo by Xueqiao Xu that animates pathfinding on a grid using A*, Dijkstra and bidirectional BFS. It shows each algorithm exploring cells around walls, and links to Python and JavaScript versions.
What people said
Recommends CuriousGeorge · 2012-04 · Stack Overflow · on “How to make this path finding C++ code into dynamic so that agent can search the path on its own”
You will need some kind of path finding algorithm [this video] . The A* ("A-Star") algorithm is probably a good place to start. This page [LINK] does a decent job of explaining it. If A* seems to complicated, you may want to try Dijkstra's algorithm first. Dijkstra's algorithm is the same as A*, but without the heuristic(estimated cost to goal).
Cites user586399 · 2011-10 · Stack Overflow · on “Wavefront algorithm for area coverage”
I have visited your site. You stated that the robot can receive commands like "Go to ketchen". Well, I advice not to re-invent the wheel. Actually, you don't have to visit every cell, or "the hole area". Rather, you should select your shortest path to it, then walk through. I believe Dijkstra's algorithm [LINK] is much better for your robot path-finding. An enhaced version of Dijkstra is A* algorithm [LINK] , which takes less time in the average case. Here [this video] you can find examples how do they work, efficiently. EDIT: I have visited your site, again. You stated that you want an algorithm for navigating all the erea. Well, as far as I know, repeating A* algorithm will be much better. A* u
Cites Zik · 2012-06 · Stack Overflow · on “Shortest path A* f(n) = g(n) + h(n)”
When you use A*, it chooses the best node which is the closest to the goal right? ( using f(n) = g(n) + h(n)) ( using Manhattan distance for h(n) ) But what if there are walls between the start and goal. I can't explain it in words but I'll show a picture. [LINK] (source: uploadir.com [LINK] ) If A* chooses the node that is closest to the goal, why is the path not the one encircled in red? But the one encircled in green. I really don't understand A* especially when there are impassable cells/tiles/nodes/etc. (walls). Also, you can see this picture I made like in this video [this video] (Path Finding Algorithms (A*, Dijkstra, Bi-Directional BFS)) at 1:20