This project is an interactive maze generator and pathfinding algorithm visualizer built using React and Vite. It allows users to generate random mazes using a recursive backtracking algorithm and visualize the process of finding a path from a start point to an end point using Breadth-First Search (BFS) and Depth-First Search (DFS) algorithms.
- Random Maze Generation: Creates complex mazes using the Recursive Backtracking algorithm.
- Pathfinding Algorithms: Implements and visualizes:
- Breadth-First Search (BFS): Finds the shortest path in an unweighted grid.
- Depth-First Search (DFS): Explores paths deeply before backtracking.
- Step-by-Step Visualization: Clearly shows how the algorithms explore the maze cells.
- Interactive Controls: Buttons to generate a new maze and run pathfinding algorithms.
- Responsive Design: Adapts to different screen sizes using CSS variables.
- Loading Indicator: Provides feedback while the maze is generating.
- Status Messages: Displays messages like "Path found!".
- Frontend Library: React 18
- Build Tool: Vite
- Language: JavaScript (JSX), CSS
- Development Environment: Node.js, npm
- (TypeScript Ready): The project includes
tsconfig.jsonand Vite configuration for TypeScript, though the core components are currently implemented in JavaScript (.jsx).
Follow these steps to set up the project locally:
- Node.js (v18 or later recommended)
- npm (usually included with Node.js)
-
Clone the repository:
git clone <your-repository-url> cd pathfinder_visualizer_kartikey
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
This command starts the Vite development server, typically on
http://localhost:5173. -
Open in browser: Navigate to the URL provided in the terminal (e.g.,
http://localhost:5173) to view the application.
- Generate Maze: Upon loading, a random maze is generated. Click the "Refresh Maze" button to create a new one.
- Run BFS: Click the "Breadth-First Search" button to visualize the BFS algorithm exploring the maze from the start (top-left green cell) to the end (bottom-right red cell). Visited cells are marked in light green.
- Run DFS: Click the "Depth-First Search" button to visualize the DFS algorithm exploring the maze.
- Observe: Watch the visualization progress. A message "Path found!" will appear if the end cell is reached.
