New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sbj42/maze-generator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sbj42/maze-generator

A simple maze generator

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

maze-generator

A javascript maze generator

This module generates a maze using "recursive backtracking". Usage:

var mazeGen = require('@sbj42/maze-generator');

// generate a 20x20 maze
var maze = mazeGen.generate(20, 20);

// get the north-east corner cell of the maze
var cell = maze.cell(0, 0);

API

generate(width, height, options)

The generate() function takes a width and a height, and returns a new maze object. The (optional) options argument can be used for additional settings:

  • options.random: (optional) A random number generator, as a function that returns a number between 0 (inclusive) and 1 (exclusive). The default random number generator is Math.random.

maze.width() / maze.height()

Return the width and height of the maze.

maze.cell(x, y)

Returns a cell object for the cell at the given position.

cell.north() / cell.east() / cell.south() / cell.west()

These boolean properties indicate whether the cell has a passage in each of the cardinal directions. If the property is true, then there is a passage in that direction. false indicates a wall.

Keywords

FAQs

Package last updated on 06 Oct 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc