Security News
Highlights from the 2024 Rails Community Survey
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
generate-maze
Advanced tools
Maze generator using a JavaScript implementation of Eller's Algorithm, as described here: http://www.neocomputer.org/projects/eller.html
Maze generator using a JavaScript implementation of Eller's Algorithm, as described here: http://www.neocomputer.org/projects/eller.html
This algorithm creates 'perfect' mazes, which guarantees a single path between any two cells, such as:
+---+---+---+---+---+---+---+
| | | |
+---+ +---+ + + + +
| | | | | |
+ + + + + + + +
| | | | | | |
+ +---+ + +---+---+ +
| | | | | | | |
+ + + + + + + +
| | | | | |
+ +---+ +---+ +---+---+
| | | | | |
+ + + + +---+ + +
| | |
+---+---+---+---+---+---+---+
Another Web example
Note: This library does not create ASCII-art or other text visualizations.
That part is up to you.
This library generates a two-dimensional array of maze cells, each with the following properties:
{
x: 4, // Horizontal position, integer
y: 7, // Vertical position, integer
top: false, // Top/Up has a wall/blocked if true, boolean
left: false, // Left has a wall/blocked if true, boolean
bottom: true, // Bottom/Down has a wall/blocked if true, boolean
right: true, // Right has a wall/blocked if true, boolean
set: 5 // Set # used to generate maze, can be ignored
}
npm install generate-maze
Example assumes you are using a module system such as node, Webpack or Browserify.
const generator = require('generate-maze');
// Width and height == 4
const maze = generator(4);
// Width == 8, height == 4
const maze = generator(8, 4);
// Width == 8, height == 4, maze edges are open
const maze = generator(8, 4, false);
// Width == 8, height == 4, maze edges are closed, using random seed
const maze = generator(8, 4, true, 123456);
_Note: the maze is an array of rows, so to access individual cells by their x/y positions, you need to specify the row first. For example:
maze[y][x]
FAQs
Maze generator using a JavaScript implementation of Eller's Algorithm, as described here: http://www.neocomputer.org/projects/eller.html
The npm package generate-maze receives a total of 25 weekly downloads. As such, generate-maze popularity was classified as not popular.
We found that generate-maze demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.