Have fun and help me to get to 1,000,000 downloads!

Breadth-first pathfinding in a randomly generated maze

Emanuele Feronato Actionscript 3, Flash, Users contributions

If you are following the blog for a long time, you should know I love mazes and pathfinding algorithms.

Just to show you a couple of examples, look at the perfect maze generation with AS3, perfect maze generation – tile based version and the basics of pathfinding – animated example.

Today Chevy Ray Johnston shares with us a simple breadth-first search pathfinding system (on a randomly generated maze).

In graph theory, breadth-first search (BFS) is a strategy for searching in a graph when search is limited to essentially two operations: (a) visit and inspect a node of a graph; (b) gain access to visit the nodes that neighbor the currently visited node. The BFS begins at a root node and inspects all the neighboring nodes. Then for each of those neighbor nodes in turn, it inspects their neighbor nodes which were unvisited, and so on. (source: Wikipedia)

Click on 2 black tiles to pathfind between them.

And here is the source code for you to study it:

You can also download the entire project.

From null to full HTML5 cross platform game

I will take you by hand from the bare bones of JavaScript programming through the creation of a full cross platform HTML5 game, with detailed explainations and source code.

If you don't know where to start, then From null to full HTML5 cross platform game is the book for you.

Comments 2

  1. Lars Eik Grambo

    Hi. I’m a programming student at Hedmark University College.

    I found this during a random search on pathfinding in flash.
    However, I find understanding your code a bit challenging, since you have not added any documentation. Would you consider adding some documentation in order to make your code more understandable?

Leave a Reply

Your email address will not be published. Required fields are marked *