Skip to content

Easy to use Maze Generator in javascript/node that has zero dependencies

Notifications You must be signed in to change notification settings

MatthewMcLeod/maze-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

maze-generator

Easy to use Maze Generator in javascript/node that has zero dependencies

Generates maze using recusive backtracking(https://en.wikipedia.org/wiki/Backtracking) to ensure there is a single solution to the maze.

To use, simply require the file

 mazeGenerator = require("maze-gen")

and then simply call it and it will return a generated maze

var maze = mazeGenerator(numOfRows, numOfCols);

where numOfRows and numOfCols are optional parameter that detail the number of rows and columns you want the maze to have.

The output will be a 2 dimensional array where each cell will be described by a json object with the format

{
				top: true, // top wall is present
				right: true, // right wall is present
				bottom: true, // bottom wall is present
				left: true, // left wall is present
}

Accessing a specific cell is by specifying row, then col.

maze[row][col]

About

Easy to use Maze Generator in javascript/node that has zero dependencies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published