npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nylira-maze

v0.4.0

Published

A library for generating mazes.

Downloads

18

Readme

nylira-maze

A JavaScript library for generating maze data.

_________________________________________________________________________________
|█|█|█|█|█|█|█|█|█|█|__ |   |█|█|█|█|█|█|█|█|   |  __ |   |█|█|█|  ______ |█|█|█|
|█|█|█|█|█|█|█|█|  __ |___|________ |█|█|█|█| |___|█| | |_________|█|█|█| |█|█|█|
|█|█|█|█|█|█|█|█|___|______ |█|█|█|____ |█|█| |█|█|█|___|█|█|█|  __ |█|█| |█|   |
|█|█|█|█|█|█|█|█|█|█|█|█|  _|  ____ |  _|█|█| |█|█|█|   |  _____|  _|  ___|  _| |
|   |█|█|█|█|█|█|█|█|█|█|_____|█|   |__ |█|█| |█|█|█| |___|█|  ___|█|____ | |  _|
| | |█|█|█|█|█|█|█|█|█|█|█|█|█|█| | |█|_______|█|█|  _|█|█|  _|█|█|█|   | | | |█|
| |______ |   |█|█|█|█|█|█|█|█|█| |________ |█|█|█|______ |___________| |___| |█|
| |█|   |___| |█|█|█|█|█|█|█|█|█| |█|█|█|█| |  ________ |__ |█|█|█|█|█|__ |█|__ |
| |█| | |█|█|________________ |█| |█|█|█|█|___|█|█|█|█|_____|█|█|█|█|█|█| |   | |
|_____|______ |█|█|█|█|  _____|█| |█|█|█|█|█|█|█|  ________ |█|█|█|█|█|█| | | | |
|  __ |█|█|█| |█|█|█|█| |  __ |█| |█|█|█|█|█|█|█|____ |█|█|______ |█|█|█|___| | |
|__ | |  _____|█|█|   | | |█|_____|   |█|█|█|█|█|█|█| |█|█|  _____|█|█|█|█|█| | |
|  _|___|  _________| |___|█|  __ | |__________ |   | |█|█| |█|   |█|_________| |
|______ | |█|█|█|█|█| |   |█| |  _| |█|█|█|█|█| | |___|█|█|_____| |█|█|█|█|█|  _|
|  _____| |█|█|█|█|█| | | |█| |_____|█|█|█|█|█| | |█|█|█|█|  _____|█|█|█|█|█|__ |
|  _______|█|█|█|█|█| | |__ |__ |█|█|█|█|█|█|█| | |█|█|█|█| |█|█|█|█|█|█|█|█|█| |
|__ |█|█|█|█|█|█|█|█|___|█| |█|______ |█|█|█|█| | |█|█|█|█|__________ |█|█|█|█| |
|  _|█|█|█|█|█|█|█|█|█|█|█| |█|█|  ___|   |█|█|___|█| |█|█|█|█|█|  ___|█|█|   | |
| |   |  ___|█|█|█|█|█|█|█| |█|█|____ | | |█|█|█|   | |█|█|█|█|█|___________| | |
|___|___|█|█|█|█|█|█|█|█|█|_____________|_________|___|█|█|█|█|█|█|█|█|█|█|█|___|

Installation

npm i nylira-maze --save

Usage

Basic usage:

var maze = require('nylira-maze')

// returns a 2d array of values for a 10x10 maze
maze()

// returns a 2d array of values for a 20x20 maze
maze(20)

// returns a 2d array of values for a 15x23 maze
maze(15, 23)

Parameters

maze(31, 23, 'growing-tree:newest', 0.65, undefined, true)
  • Parameter 1: Width.
  • Parameter 2: Height.
  • Parameter 3: The maze generation algorithm. Options:
    • "growing-tree": The Growing Tree algorithm. Defaults to random.
    • "growing-tree:random": Lots of dead ends, similar to Prim's Algorithm
    • "growing-tree:newest": Long windy passages, similar to "backtracker"
    • "growing-tree:middle": Lots of long straight passages.
    • "growing-tree:oldest": Only long straight passages.
    • "backtracker": The Recursive Backtracker algorithm. Tends towards long and twisted passages.
  • Parameter 4: Sparseness. A sparse maze will have some of its nodes removed. If you type in a value less than 1, e.g. 0.25, the maze will be 25% sparse. If you enter an integer value more than 1, e.g. 5, the maze will remove 5 nodes from each of its dead ends.
  • Parameter 5: The integer seed for the maze. Putting a value here will guaranteee you can recreate the maze over and over again.
  • Parameter 6: You can preview the grid by passing in true as the fifth parameter.

That function call above will generate the following:

_______________________________________________________________
|█|█|█|____________________ |█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|
|█|█|█|█|█|█|█|█|█|█|█|█|█|__ |  _|█|█|█|█|█| |█|█|█|█|█|█|█|█|
|█|█|█|█|█|█|█|█|█|█|█|█|█|█|__ |█|█|█|█|█|  _|█|█|█|█|█|█|█|█|
|█|█|█|____ |█|█|█|█|█|█|█|█|█| |█|█|█|█|  _|█|█|█|█|  ___|█|█|
|█|█|█|█|█|________ |█|█|__ |█| |█|█|█|█| |█|█|█|█|  _|█|█|█|█|
|█|█|█|█|█|█|█|█|█| |█|█|█|__ |____ |  ________  ___|█|█|█|█|█|
|█|█|█|█|█| |█|█|  ______ |  ______  _|█|█|█|█|_____|█|█|█|█|█|
|█|█|█|█|█|__ |   |█|█|█|___|█|█|  ____   |█|█|█|█|█|█|█|█|█|█|
|█|____  ____  _| |█|█|█|█|█|  __ |█|█| |____ |█|█|█|█|█|█|█|█|
|█|█|  _|█|█| |█|_|█|█|█|█|  _|█|   |█| |█|█|  _________|█|█|█|
|█|___|█|█|█| |█|█|█|  __  _|█|█| | |█|__ |█| |█|█|█|█|█|█|█|█|
|█|█|█|█|█|█|_|█|█|█| |█|_|█|█|  _| |█|█| |█|__ |█|█|█|█|█|█|█|
|█|█|█|█|█|█|█|█|█|  _|█|█|█|█| |█| |█|█|____ |__  __________ |
|█|█|█|█|█|█|█|█|█| |█|█|█|█|█| |█| |█|█|█|  _|█|__   |█|█|   |
|█|█|█|█|█|█| |█|  _|█|█|█|  ___|█|   |█|█| |█|█|█| | |█|█| | |
|█|█|█|__  ______ |█|█|█|█| |█|█|█| | |█|█| |█|█|█| | |█|█| | |
|█|█|█|█| |█|█|█| |█|█|█|█| |█|█|  _| |█|█| |█|█|█| | |█|█| |_|
|█|  _____|█|█|█| |█|█|_____|█|  _|█| |█|█| |█|█|  _| |█|█| |█|
|█|_|█|█|  __ |   |█|█|█|█|█|█| |█|█|_____|____ | |█|_|█|█|_|█|
|█|█|█|___|█|___|_|█|█|█|█|█|    __ |█|█|█|█|█| |_|█|█|█|█|█|█|
|█|█|█|█|█|█|█|█|█|█|█|█|█|█|_|_|█|_|█|█|█|█|█|_|█|█|█|█|█|█|█|
|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|
|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|█|

The maze at the top of the README was generated with this function:

maze(40, 20, 'growingtree:newest', 0.47, undefined, true)

Test

Check out a demo.

npm test

License

MIT