@ludw1gj/maze-generation
TypeScript icon, indicating that this package has built-in type declarations

0.7.1 • Public • Published

Maze Generation

Recursive Backtracking

  1. Make the initial cell the current cell and mark it as visited.
  2. While there are unvisited cells:
    1. If the current cell has any neighbours which have not been visited
      1. Choose randomly one of the unvisited neighbours
      2. Push the current cell to the stack
      3. Remove the wall between the current cell and the chosen cell
      4. Make the chosen cell the current cell and mark it as visited
    2. Else if stack is not empty
      1. Pop a cell from the stack
      2. Make it the current cell

Dependencies (0)

    Dev Dependencies (5)

    Package Sidebar

    Install

    npm i @ludw1gj/maze-generation

    Weekly Downloads

    0

    Version

    0.7.1

    License

    ISC

    Unpacked Size

    19.2 kB

    Total Files

    20

    Last publish

    Collaborators

    • ludw1gj