A C++ console-based application that visualizes common pathfinding algorithms on a 2D grid.
- Interactive console visualization with Windows Console API
- Multiple pathfinding algorithms:
- Dijkstra's Algorithm
- A* Search Algorithm
- Breadth-First Search (BFS)
- Depth-First Search (DFS)
- Random maze generation
- Visual representation of:
- Start and end points
- Walls/obstacles
- Visited nodes
- Final path
Pathfinding Visualizer
1. Dijkstra's Algorithm
2. A* Search
3. Breadth-First Search
4. Depth-First Search
5. Generate Random Walls
6. Clear Grid
7. Quit
The visualizer shows the progress of algorithms with colored cells:
- Green (S): Start point
- Red (E): End point
- White blocks: Walls/obstacles
- Blue blocks: Visited nodes
- Yellow blocks: Final path
- C++11 or later
- Terminal that supports ANSI color codes
- Clone the repository:
git clone https://github.com/Nitin2489/pathfinding-visualizer.git
cd pathfinding-visualizer- Compile the code:
g++ -std=c++17 -o pathfinding pathfinding.cpp- Run the program:
./pathfinding- Start the program
- Choose an algorithm by entering its corresponding number
- Watch the algorithm explore the grid
- The final path will be highlighted once found
- Press Enter to return to the menu
- Generate random walls or clear the grid as needed
A weighted graph algorithm that guarantees the shortest path by exploring nodes in order of their distance from the start.
An informed search algorithm that uses a heuristic (Manhattan distance) to guide its search toward the goal, typically more efficient than Dijkstra's.
A simple unweighted algorithm that explores all neighbors at the current depth before moving to nodes at the next depth level.
An algorithm that explores as far as possible along a branch before backtracking, which may not find the shortest path but uses less memory.
Contributions are welcome! Please feel free to submit a Pull Request.