A* pathfinding visualization web app made with React.
- Drag and move the start block and the end block around.
- Click on the start button to start finding the path.
- Paint on the grid to place or erase wall blocks.
- Click on the clear button to clear all walls or all paths
- Click on the heuristic button to open the heuristic editor. (See Heuristic)
This project has implemented the A* algorithm from the pseudocode described on Wikipedia, the pseudocode can be found at src/algorithms/aStar.pseudo, and the TypeScript implementation can be found at src/algorithms/aStar.ts.
This project uses the depth-first search algorithm with recursive implementation to generate a maze, which is described as blow:
1. Given a current cell as a parameter
2. Mark the current cell as visited
3. While the current cell has any unvisited neighbour cells
1. Choose one of the unvisited neighbours
2. Remove the wall between the current cell and the chosen cell
3. Invoke the routine recursively for a chosen cell
The TypeScript(JavaScript) implementation can be found at src/algorithms/mazeGenerate.ts
This project provides a heuristic function editor, which is using JavaScript, by changing the return value of the function may help understand how heuristic affects the pathfinding algorithm.
- A* search algorithm - Wikipedia
- Introduction to the A* Algorithm - Red Blob Games
- Maze generate - Wikipedia
$ git clone https://github.com/rnike/astar-visualizer.git
$ cd astar-visualizer
$ yarn && yarn start
This project is intended for studying the A* algorithm, any kind of contributions are welcome, including forking this project, making pull requests, and reporting issues.
- MIT