Scrambled

This is a Node.js package for generating Rubik's cube scrambles.

Basically, a "scramble" in this context is just a list of moves to get a Rubik's cube out of the solved state, into an unsolved state. A scramble is made up of letters which each represent a clockwise turn of a different face. For example, "R" would be a clockwise turn of the right face. L, the left face. F, the front face and so on. If an apostrophe follows a character (for example, R'), that means the turn is counter-clockwise. R' would be a counter-clockwise turn of the right face, L' would be the left face, and so on.

This library is made to randomly generate a set of these moves, for the domain of speedcubing. It also provides a way to check if a scramble was generated by this library, via providing the seed, or hash, it was generated with.

const scrambled = require('scrambled');

// Generate a 30 move long scramble for a 3x3 Rubik's cube.
let scramble = scrambled.generateScrambleSync(30);
console.log(scramble);

And verification of Scrambles is also simple:

let scramble = scramble.generateScrambleSync(30);

let result = scramble.verifyScrambleSync(scramble.token, scramble.scramble, scramble.size);

if (result)
    console.log('This scramble is verified!');
else
    console.log('This scramble not verified.');

Copyright © 2021 Zack Pace. [work in progress]