@cubertimer/scrambler
v0.2.0
Published
Random state scrambles for speedcubing puzzles, following the WCA method. Pure TypeScript, no dependency, works in React Native.
Maintainers
Readme
Why
Existing scramblers do not fit React Native apps: the reference ones (TNoodle, min2phase, csTimer) are GPL licensed, and cubing.js needs browser APIs that React Native does not provide. This library brings random state scrambles to React Native under the MIT license.
Features
- Random state 3x3 scrambles (two-phase algorithm)
- Pure TypeScript, no dependency
- Runs in React Native, Node and the browser
- Secure randomness by default
Usage
import { prepareAsync, randomScramble } from '@cubertimer/scrambler';
await prepareAsync('333');
const scramble = randomScramble('333');prepareAsync builds the tables in short slices so the app stays responsive. Use prepare to build them at once.
In React Native, install expo-crypto or react-native-get-random-values first.
Development
npm install
npm test
npm run build