Welcome to the Wave Function Collapse Maze Generator and Solver! This project implements a maze generator and solver using the Wave Function Collapse (WFC) algorithm. The WFC algorithm is a procedural content generation technique that can create intricate patterns, such as mazes, based on a set of input constraints.
The Wave Function Collapse (WFC) Maze Generator and Solver uses the WFC algorithm to generate complex and unique mazes. It also includes a solver that can find a path through the generated mazes. The WFC algorithm is known for its ability to create visually appealing and non-repetitive patterns, making it ideal for generating mazes.
The Wave Function Collapse algorithm is inspired by quantum mechanics and the concept of superposition. Here's a simple explanation:
-
Superposition: Imagine each cell in a grid having multiple possible states (like walls or paths in a maze). Initially, each cell can be in any state.
-
Observation: You pick a cell and determine its state based on some rules and the states of its neighboring cells. This is similar to observing a quantum particle, collapsing its superposition into a single state.
-
Propagation: Once a cell's state is determined, this influences the possible states of its neighboring cells. This propagation continues until all cells have their states determined.
-
Backtracking: If a contradiction occurs (where no valid state is possible for a cell), the algorithm backtracks to a previous state and tries a different possibility.
In the context of maze generation, the WFC algorithm ensures that the generated maze is consistent and follows the defined rules, resulting in a coherent and solvable maze.
- Maze Generation: Generate unique and intricate mazes using the WFC algorithm.
- Maze Solving: Find a path through the generated mazes.
- Customizable Parameters: Adjust the size and complexity of the generated mazes.
To install and run the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/wfc-maze-generator-solver.git cd wfc-maze-generator-solver
-
Install dependencies:
npm install
-
Start the application:
npm start
- Open your browser and navigate to
http://localhost:3000
. - Use the interface to generate and solve mazes.
- Adjust the parameters to explore different maze configurations.
Contributions are welcome! If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
- Fork the repository.
- Create a feature branch (
git checkout -b feature/your-feature-name
). - Commit your changes (
git commit -am 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature-name
). - Create a new Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.