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 🙏

© 2026 – Pkg Stats / Ryan Hefner

mazely

v0.5.0

Published

TypeScript toolkit for deterministic maze generation, solving, editing, and serialization.

Downloads

231

Readme

mazely

Maze generation, solving, and editing for TypeScript.

mazely is the recommended package entry point. It provides createMaze() with practical defaults plus the complete public API and TypeScript types.

Highlights

  • Twelve deterministic generation algorithms and five solving algorithms
  • Square, triangular, and hexagonal grids with connected-cell masks
  • Triangular and hexagonal outer layouts, plus pointy/flat Hex orientation
  • Seeded generation, reversible step playback, and transactional editing
  • JSON-safe grid serialization with topology metadata

Install

pnpm add mazely
npm install mazely

Quick Start

import { createMaze } from 'mazely'

const maze = createMaze({
  grid: { type: 'square', cols: 21, rows: 21 },
  seed: 42,
})

maze.generate('dfs', { start: { x: 0, y: 0 } }).finish()
maze.solve('a-star', {
  start: { x: 0, y: 0 },
  end: { x: 20, y: 20 },
}).finish()

const result = maze.getSolveResult()
console.log(result?.solved, result?.path, result?.visitedCount)

createMaze() defaults to a 21 × 21 square grid. Supply grid to select a topology, explicit dimensions, or a mask.

Grid Topologies

Triangle grids use alternating up/down cells and support triangular or rectangular outer boundaries:

const triangle = createMaze({
  grid: { type: 'triangle', layout: 'triangle', size: 20 },
  seed: 'triangles',
})

triangle.generate('prim').finish()

Hexagonal grids use regular six-sided cells. They support rectangular and hexagonal outer boundaries, each with pointy or flat orientation:

const hexagon = createMaze({
  grid: {
    type: 'hexagon',
    layout: 'hexagon',
    size: 10,
    orientation: 'flat',
  },
  seed: 'hexagons',
})

hexagon.generate('dfs').finish()

Use { type: 'hexagon', layout: 'rectangle', rows, cols, orientation } for a rectangular Hex boundary. All grid types support connected boolean masks and every built-in generation algorithm.

Algorithms and Playback

Generation and solving return a StepPlayer. Call next() and prev() for reversible playback, reset() to return to the initial state, or finish() to complete immediately.

const player = maze.generate('prim')

while (player.next()) {
  const step = player.lastStep
  // Read step.payload and maze.grid to update application state.
}

Generation algorithms are aldous-broder, binary-tree, dfs, eller, growing-tree, hunt-and-kill, kruskal, prim, recursive-division, sidewinder, traversal, and wilson.

Solving algorithms are a-star, best-first, bfs, dfs, and flood. flood visits every reachable cell and does not need an end point.

Editing and Serialization

Use maze.edit() for transactional passage changes. Use serializeGrid() and applySerializedGrid() to store and restore compatible grid topology and open edges; serialized Hex data retains its layout, orientation, and side size.

import { applySerializedGrid, serializeGrid } from 'mazely'

const saved = serializeGrid(maze.grid)
applySerializedGrid(maze.grid, saved)

Defaults

  • maze size: 21 × 21
  • grid type: square
  • generation algorithm: dfs

Learn More

License

MIT