Wednesday, March 30, 2016

Breadth First Search - Matrix

So yesterday during class, we discussed how to make a path finding algorithm for a 2d map. I immediately thought of the example of flooding the map with water like I have seen before.

We didn't have to code it in class, we just had to know how one would write the algorithm. Last night I decided that I would try to code it and here is my work:


In my grid I make the starting cell marked with an X and the destination is marked with a D. The final path would be calculated by simply following the cell values in descending order to the final destination.

That's all for now, thanks for reading!

No comments:

Post a Comment