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

cube-scramble

v0.1.6

Published

Pure ESM scramble generator for cubes and related puzzles.

Readme

cube-scramble

npm version npm downloads node >=18 license

Pure JavaScript scramble generator for cubes and related twisty puzzles. Ships both ESM and CJS builds for easy use in Node, Vite/Nuxt, and build pipelines.

Install

npm install cube-scramble

Usage

ESM

import { getScramble, getScrambleTypes, setSeed } from "cube-scramble";

setSeed("42");                    // optional deterministic seed
console.log(getScrambleTypes());  // list available scramble types
console.log(getScramble("333"));  // generate a 3x3 scramble string
console.log(getScramble("444wca", 40)); // type with custom length

CommonJS

const { getScramble, setSeed } = require("cube-scramble");
setSeed("42");
console.log(getScramble("222so"));

API

  • getScrambleTypes(): string[] — all supported scramble type ids.
  • setSeed(seed: string | number): void — set deterministic seed (uses ISAAC RNG). Call before getScramble to make results reproducible.
  • getScramble(type: string, length?: number, state?: any, neutrality?: number): string — generate a scramble for the given type. length, state, and neutrality are optional and used by specific generators (e.g., Square-1, Mega).

Examples

Generate WCA event scrambles:

import { getScramble, getScrambleTypes, setSeed } from "cube-scramble";

// list all scramble type ids
console.log(getScrambleTypes());
// Set seed of scramble generator. Uses a CSPRNG (crypto.getRandomValues; falls back to timestamp).
// The seed should be a string; other types will be coerced via Object.prototype.toString().
setSeed("42"); // deterministic RNG seed

// Generate scrambles for common WCA events.
const wcaEvents = [
	["3x3x3", "333", 0],
	["2x2x2", "222so", 0],
	["4x4x4", "444wca", 0],
	["5x5x5", "555wca", 60],
	["6x6x6", "666wca", 80],
	["7x7x7", "777wca", 100],
	["3x3 bld", "333ni", 0],
	["3x3 fm", "333fm", 0],
	["3x3 oh", "333", 0],
	["clock", "clkwca", 0],
	["megaminx", "mgmp", 70],
	["pyraminx", "pyrso", 10],
	["skewb", "skbso", 0],
	["sq1", "sqrs", 0],
	["4x4 bld", "444bld", 40],
	["5x5 bld", "555bld", 60],
	["3x3 mbld", "r3ni", 5]
];

for (const [label, type, length] of wcaEvents) {
	const scramble = getScramble(type, length);
	console.log(`Generated scramble for ${label}:`, scramble);
}

CLI smoke test (local)

After clone/install, you can sanity-check without building:

node examples/get-scramble.js 333 0 42   # type length seed

Build

npm install
npm run build   # outputs dist/index.js (ESM) and dist/index.cjs (CJS)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

See CONTRIBUTING.md for guidelines.

GitHub

License

GPL-3.0