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

@rafalnawojczyk/scrambow

v1.8.3

Published

Javascript Rubik's Cube Scramble Generator

Downloads

13

Readme

Scrambow - Puzzle Scramble Generator

scrambo

Usage

// Generate a new 4x4 scramble with the seed of 1
var seeded_scramble = new Scrambow().setType('444').setSeed(1).get();
console.log(seeded_scramble);

// Generate 5 scrambles (defaults to 3x3)
var multiple_scrambles = new Scrambow().get(5);
console.log(multiple_scrambles);

Cli

# install
npm install -g scrambow
# or
yarn global add scrambow

# usage
scrambow -t 333 -n 5

# only generate 2gll scrambles with H, Pi or T corner orientations
scrambow -t 2gll -n 100 H Pi T

# only generate zz scrambles with 0, 6 or 12 flipped edges
scrambow -t zz -n 12 0 6 12

Command line options

-V, --version        output the version number
-n, --number [num]   set amount of scrambles to generate
-t, --type [string]  set the scramble type (default: "333")
-s, --seed [num]     set seed
-l, --length [num]   set scramble length
-h, --help           output usage information

Node.js

npm install scrambow
# or
yarn add scrambow
var Scrambow = require('scrambow').Scrambow;

var threebythree = new Scrambow(); // Defaults to 3x3
console.log(threebythree.get(5)); // Returns 5 scrambles

API

.get(num); // Returns a number of scrambles, defaults to 1.
.setType(str); // Sets the scramble type, defaults to 333.
.setSeed(num); // Repeatable scrambles.
.setLength(num); // Set scramble length, currently only for NNN, minx scrambles.
.setArgs(...args); // Set scramble args for 2gll, cls, trizbll, tsle, zbll and zz

.registerCustomScrambler(name, scrambler, aliases = []) // used to register custom scramblers

Adding custom scramblers

Scrambow allows adding custom scramblers as long as they include the follwing 4 functions:

  • initialize(randomSrc)
    • Function that sets the random source and runs any other initialization for the scrambler
  • setRandomSource(randomSrc)
    • Function to set how random numbers are generated (usually Math.random)
  • setScrambleLength(length)
    • Function to set how long scrambles are (if needed)
  • getRandomScramble(args)
    • Function used to generate scrambles. Accepts a list of args that can be used to modify the scrambler's behavior (e.g. only generate Sune CMLLs)

initialize, setRandomSource and setScrambleLength can all be pass through functions, but they must exist because they will always be called

// Example
const myCustomScrambler = (() => {
  const initialize = () => { /* do nothing */ };
  const setRandomSource = () => { /* do nothing */ };
  const setScrambleLength = () => { /* do nothing */ };
  const getRandomScramble = () => ({ scramble_string: 'cool scramble' });

  return {
    initialize,
    setRandomSource,
    setScrambleLength,
    getRandomScramble
  };
})();

The custom scrambler can then be added to Scrambow using registerCustomScrambler

const scrambow = new Scrambow();
scrambow.registerCustomScrambler('myCustomScrambler', myCustomScrambler)

scrambow.setType('myCustomScrambler').get(); // { scramble_string: 'cool scramble' }

Scramblers

Current list of supported scramblers

  • 2x2

  • 3x3

    subsets

    • 2gll

      args: U, T, L, S, As, Pi, H

    • ble

    • cls

      args: -, +, O, i, im

    • cmll

      args: U, T, L, S, As, Pi, H

    • edges

    • fmc

    • lccp

    • ll

    • lsll

    • lu

    • nls

    • pll

    • random moves (non random state)

      • lse
      • lu
      • ru
      • rud
      • rul
    • trizbll

      args: U, T, L, S, As, Pi, H

    • tsle

      args: twoGen

    • wv

    • zz

      args: # of flipped edges

    • zzll

    • zzlsll

  • 4x4

  • 5x5

  • 6x6

  • 7x7

  • clock

  • clock-optimal

  • megaminx

  • pyraminx

  • skewb

  • square 1

Credits

This is a fork of scrambo