A good initiative! So good that I will take the time to point out any errors I find
The first thing I noticed is that you treat your paragraphs inconsistently, making the whole thing a bit hard to read. Always put a newline between every paragraph, without any exceptions, and you'll be fine
If you are inside a maze and you are at the starting point and there is an exit, you need to search for the exit.
This may give the reader the impression that they could use A* if they ever find themselves inside a maze. But A* only works if you already know what the labyrinth looks like.
However, even with A*, sometimes it cant perform well. A maze is a good example because in a maze the only possible path to the exit might also be the longest one, which with the most common heuristics of A* will make it go search for a lot of wrong paths with dead ends.
In an environment that is not exactly a maze, but also not an open field, A* can be very efficient.
You are implying that there may be better options than A* to this problem. But A* will find the optimal solution in the fastest possible wayΉ given a specific heuristic. So even if you have a complex maze, you can't really find a better algorithm. If the problem takes time to solve even when using a good heuristic, it's simply a difficult problem.
But unless you solve the problem every frame for such a maze (which you shouldn't be doing), A* can easily find the optimal path for extremely huge, complex labyrinths. So there is no reason to tell people not to use A* for big stuff.
[lots of code]
I won't read and try understand the actual code right now, but it's good that you have it in there. You should probably mention what language it's written in, so that people can try it out. If you also add imports and a small usage example it will be easy for people to run the code for themselves.
In addition to that it would be good to add a permissive license to the code, so that people can try it out in their own projects. If you just say something like "Code license: CC-BY"
. Then people can use the code in any way they want, either to experiment with or put in their own projects, as long as they credit you or your post for that code. As it is now, people can't really use your code for anything meaningful without breaking the law. (Which is absurd, I know, but it's how it is)
A small style note: please consider using 1TBS indentation
for your brackets. While it is largely a matter of taste, it makes for more compact code without adding any clutter, making it easier to skim through lots of code.
If you plan to post more code in the future, you may also want to consider adding code highlighting support to your wordpress.Overall impressions:
I couldn't really follow the explanation. I get the impression that you're still a bit intimidated by the algorithm (which is understandable) which makes it hard for you to break it down and explain it. But writing this post is probably a good step towards getting that deeper understanding.
I would probably have focused more on the heart of the algorithm: the priority queue. Once I understood how that worked the other pieces fell into place for me (if I remember correctly, it's been a few years now)Ή Lowest number of explored squares/nodes in the maze