scramble-generator
npm install scramble-generator
0.2.0 has breaking changes. If you're using < v0.2.0, see the upgrading section.
API
generateScramble
Generates a random scramble for the given cube size.
Parameters
$0
any (optional, default{}
)$0.cubeSize
(optional, default3
)$0.length
(optional, default(cubeSize-2)*20||8
)$0.formatted
(optional, defaulttrue
)
Examples
;;// R' U F D' L ... ;// [ { face: 'U', inverted: false, double: true },// { face: 'R', inverted: true, double: false },// { face: 'D', inverted: false, double: true }, ... ]
Returns (string | Array<Move>)
formatScramble
Formats a given scramble as a string.
Parameters
scramble
Array<Move> List of Move objects representing a scramble to be formatted.
Examples
;;// "R' U2 L"
Returns string String representation of the given scramble.
Upgrading
From v0.1.x
v0.2.0 has breaking changes. To upgrade from an earlier version:
// Before:; ; // R U' D ...const scramble = ; // [{ face: 'R', longFace: 'RIGHT', inverted: true, double: false }, ...] // R' ... // [{ face: 'R', longFace: 'RIGHT', inverted: true, double: false }, ...] // After;; ; // R U' D ...const scramble = ; // [{ face: 'R', inverted: true, double: false }, ...] (NB: `longFace` has been removed); // R' ...; // [{ face: 'R', inverted: true, double: false }, ...] (NB: `longFace` has been removed)
These breaking changes are necessary to facilitate moving towards v1.0.0, after which the package will adhere strictly to semver. There might be some more breaking changes