Lucas Garron
Premium Member
If you're writing a web timer or other cubing program that uses scrambles, we've worked to make cubing.js as easy as possible to use via the `cubing/scramble` module. Basically, this:
I've put together a video explaining how to get started with such code:
If you're writing such a program, I would highly recommend using cubing.js. Almost all other timer web apps (including that used by qqTimer and csTimer) use unlicensed code based on my earlier project, JSSS. Unfortunately, JSSS uses unlicensed code from a variety of authors and technically falls into a legal gray area, and is best to avoid.
cubing.js also comes with conveniences like:
Documentation for `cubing/scramble`: https://js.cubing.net/cubing/scramble/
Sample code from the video: https://github.com/cubing/twizzle-diaries/tree/main/ep4-scramble-demo
If you have any questions about using cubing.js for scrambles, feel welcome to tag me in this thread (or file an issue) and I'll see what I can do to help!
Code:
import { randomScrambleForEvent } from "https://cdn.cubing.net/js/cubing/scramble";
const scramble = await randomScrambleForEvent("333");
I've put together a video explaining how to get started with such code:
If you're writing such a program, I would highly recommend using cubing.js. Almost all other timer web apps (including that used by qqTimer and csTimer) use unlicensed code based on my earlier project, JSSS. Unfortunately, JSSS uses unlicensed code from a variety of authors and technically falls into a legal gray area, and is best to avoid.
cubing.js also comes with conveniences like:
- Automatically calculating scrambles in the background (using web workers), so that your page doesn't freeze up.
- Support for all WCA puzzles, thanks to code from Chen Shuang, Tom Rokicki, and Walter Souza — and more (FTO, master tetra, kilominx, Redi cube), thanks to @xyzzy!
- Convenient usage with other parts of cubing.js that to work with algs, display them for all supported puzzles, and animate them.
- The code API is based on "async" JS Promises. This is now fairly standard, but it may require adaptations to work in older app code.
- Scramble filtering is not fully implemented, so the scrambles are not 100% compatible with WCA Regulations yet. (Note: this was also the case for JSSS, so you're still not losing anything by dropping JSSS.)
- The code is still only published under the GPL license, so any app code based on cubing.js must be shared publicly.
Documentation for `cubing/scramble`: https://js.cubing.net/cubing/scramble/
Sample code from the video: https://github.com/cubing/twizzle-diaries/tree/main/ep4-scramble-demo
If you have any questions about using cubing.js for scrambles, feel welcome to tag me in this thread (or file an issue) and I'll see what I can do to help!
Last edited: