Looking for simple examples of A* pathfinding algorithm

Hi, as the title says I’m looking for a simple example of the A* algorithm as shown in the following link down below:

I have also looked at the example made by Peter Lager, however it was way to hard for someone like me who’s not as good at programming in java script yet :wink:
I learn best through examples so it would be really great if i could get to see one

Have you looked at the github page?

Also here is my pathfinding attempt. Please note this is djikstra not a* as I coded it before understanding how a* works. In any case my algorithm starts on a tile seeks its closest parent node then stores that distance. Each path tile has two parent nodes and two neighbouring path tiles.
takes the euclidean distance from the next parent node to the target tile and evaluates which one has the smallest step count. A step is one tile.

For the pathfinding I use the information stored above, if the starting tile is a path tile then find its the parent nearest to the target tile and search for next nearest parent.

I implemented a singular search and a multisearch which will search many paths at once.

I also started the complete path finder, this will map every node to every other node and therefore takes longer than the other methods but has the advantage of being one and done meaning that once complete there’s no more calculations necessary as each path is known and so is their distance. Only issue is with this is I never coded the final part which would let you test this, only coded the first part which calculates the path step size. From what I understand this is almost what a* is supposed to do however a* would only be concerned with calculating the x tile distance the y tile distance and also the euristic or the manhattan or the euclidean distance.

Then the same path find algorithm could be implemented to search using those distances as a criteria as opposed to distance to parent node.

Here are a few other videos that step through the algorithm very clearly using visual aids. They use other languages but the algorithm is what is important.

1 Like