This project is an interactive maze generator and pathfinding algorithm visualizer built with React. It allows users to generate random mazes and visualize two popular pathfinding algorithms: Breadth-First Search (BFS) and Depth-First Search (DFS).
- Random maze generation
- Interactive visualization of maze generation
- Breadth-First Search (BFS) pathfinding algorithm
- Depth-First Search (DFS) pathfinding algorithm
- Real-time visualization of pathfinding algorithms
- Responsive design for various screen sizes
[Add a link to your live demo here, if available]
These instructions will help you set up the project on your local machine for development and testing purposes.
- Node.js (version 12 or later)
- npm (usually comes with Node.js)
-
Clone the repository:
git clone https://github.com/your-username/mazegrid-react.git
-
Navigate to the project directory:
cd mazegrid-react
-
Install the dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your browser and visit
http://localhost:3000
to see the application running.
- Click the "Refresh Maze" button to generate a new random maze.
- Click "Breadth-First Search" to visualize the BFS algorithm.
- Click "Depth-First Search" to visualize the DFS algorithm.
- Watch as the algorithms explore the maze and find the path from start to end.
The project uses React for the user interface and implements the following key features:
- Maze Generation: Uses a recursive backtracking algorithm to create random mazes.
- Breadth-First Search (BFS): Implements BFS for pathfinding, guaranteeing the shortest path.
- Depth-First Search (DFS): Implements DFS for pathfinding, which may not find the shortest path but is memory-efficient.
- Visualization: Uses React state and timeouts to create step-by-step visualizations of the algorithms.
This project is set up to run on Repl.it, which provides a quick and easy way to get started with React development.
- React is a popular JavaScript library for building user interfaces.
- Vite is a blazing fast frontend build tool that includes features like Hot Module Reloading (HMR), optimized builds, and TypeScript support out of the box.
- Using the two in conjunction is one of the fastest ways to build a web app.
- Hit the "Run" button
- Edit
App.jsx
and watch it live update!
By default, Replit runs the dev
script, but you can configure it by changing the run
field in the .replit
configuration file. Here are the Vite docs for serving production websites.
To use TypeScript, just rename any file from .jsx
to .tsx
. You can also try our TypeScript Template.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Thanks to the React team for creating an amazing library
- Inspiration from various maze generation and pathfinding visualization projects