amazebasics / WFCMazeWebApp

This is an interactive maze generator and solver using the Wave Function Collapse Algorithm
Creative Commons Zero v1.0 Universal
0 stars 4 forks source link

Wave Function Collapse Maze Generator and Solver

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.

Table of Contents

Introduction

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.

Wave Function Collapse Algorithm

The Wave Function Collapse algorithm is inspired by quantum mechanics and the concept of superposition. Here's a simple explanation:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Features

Installation

To install and run the project locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/yourusername/wfc-maze-generator-solver.git
    cd wfc-maze-generator-solver
  2. Install dependencies:

    npm install
  3. Start the application:

    npm start

Usage

  1. Open your browser and navigate to http://localhost:3000.
  2. Use the interface to generate and solve mazes.
  3. Adjust the parameters to explore different maze configurations.

Contributing

Contributions are welcome! If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/your-feature-name).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin feature/your-feature-name).
  5. Create a new Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.