How the scramble generator works
/scramble/gen is the unified scramble entry point. Three modes cover the common needs: "official WCA scramble sheet", "quick N scrambles to practice", "paste my own scrambles for preview". All WCA events go through Lucas Garron's cubing.js random-state scramblers (3×3 can switch to the min2phase-rust engine — cs0x7f Kociemba ported to Rust, ~10× faster; 4×4 routes to cs0x7f Threephase via a Web Worker pool; 5×5 can switch to our server-side cube555 daemon for true random-state). Beyond WCA 21 we plug in three more sources: 5 random-state events from cubing.js twizzleEvents (FTO / Master Tetra / Kilominx / Redi / Baby FTO); 31 events vendored from cs0x7f csTimer (Gear / Ivy / Dino / Sq2 / SSq1 / Pyraminx Crystal / Gigaminx / Helicopter / 5 cuboids / 15-puzzle / 8-puzzle / …); 7 shape mods borrowing WCA scrambles (Mirror Blocks / Fisher / Mastermorphix / Pyramorphix / Axis / Windmill / Ghost / Void). 64 puzzles total; non-WCA ones collapse behind an "Other ▾" chip by default.
The three modes
Comp
tnoodleA full WCA-style scramble sheet — multi-event, multi-round, multi-group, with format / sets / copies all configurable. Or paste a WCA comp id to pull published scrambles.
- Mock a competition-day scramble run
- Make club / weekly-comp scramble sheets
- Browse real published scrambles from past comps
Output
Web table + tnoodle-style PDF (with preview thumbnails — toggleable).
Batch
quickPick one or more events + a count (1-1000). Multi-event runs in parallel; each event reports its own timing.
- Daily practice scramble sets
- Seeds for A/B benchmarks or statistical runs
- Copy 100 scrambles into csTimer / Twisty Timer in one go
Output
Per-event tables (click a row to copy one scramble) + one-click PDF export.
Paste
manualBring your own scrambles, get previews. Tolerates leading "1. " / "1) " numbering.
- Turn scrambles from elsewhere (old comp / a friend) into a PDF
- Peek at the 2D net of a specific scramble set
- Sanity-check a paste against its source
Output
Live preview + one-click PDF export.
Comp-mode flow
Configure → background prefetch silently fills a pool → clicking Generate snaps to the view almost instantly because pool drain is free.
Batch / paste flow
Config is the result. Tweaking events or count triggers an immediate regen; what you see is always live — no "apply" button.
Engine selection
| Event | Engine | Where | Notes |
|---|---|---|---|
| 3×3 | cubing.js (default) or min2phase-rust | browser (WASM) | Default: cubing.js TS impl. Toggle to min2phase-rust (cs0x7f Kociemba ported to Rust, 117 KB WASM lazy-loaded) for ~10× speed, equivalent length distribution. |
| 2×2 / 3×3 BLD / OH / FT / FM / MBLD | cubing.js | browser | random-state, millisecond |
| 4×4 | cs0x7f Threephase | browser Web Worker pool | random-state; ~3 s cold table build, then ms once pool is warm |
| 5×5 | cubing.js (default) or cube555 daemon | browser / server | Default is the WCA 60-move random-move; toggle to "random-state" for the server (~70 moves, uniform). details |
| 6×6 / 7×7 | cubing.js | browser | WCA 80 / 100 random-move |
| high-order N×N (N ≥ 8) | in-house random-move (linear 20·(N-2)) | browser | No WCA spec; mirrors the same-axis rejection used by 5/6/7 |
| Pyraminx / Skewb / Sq-1 / Megaminx / Clock | cubing.js | browser | random-state (per-puzzle solver) |
| Non-WCA: FTO / Master Tetra / Kilominx / Redi / Baby FTO | cubing.js | browser | Random-state (cubing.js twizzleEvents) |
| Non-WCA: Gear / Ivy / Dino / Sq2 / SSq1 / BSq1 / Gigaminx / Pyraminx Crystal / Helicopter / Curvy Copter / Master Pyra RS / 2×2×3 / 1×3×3 / 2×3×3 / 3×3×4-7 / 15-puzzle / 8-puzzle / Super Floppy / UFO / Icosamate / Crazy 3×3 / Cmetrick / Cmetrick Mini / Bicube / Siamese ×3 / Diamond | cs0x7f csTimer | browser Web Worker | Upstream source vendored at tools/cstimer-scramble/ (GPLv3); classic worker importScripts the full lib + scramble files. 13 random-state (IDA + runtime prune tables), 18 random-move. Cold start ~100-300 ms, hot path < 50 ms. |
| Shape mods: Mirror Blocks / Fisher / Mastermorphix / Pyramorphix / Axis / Windmill / Ghost / Void | borrows WCA scramble | browser | Sticker-shape variants of 3×3 (or 2×2 for Pyramorphix) — same underlying cube state, so we route to the WCA pool with zero extra algorithm. Preview renders the underlying puzzle's unfolded net. |
3×3 engine comparison
When 3×3 is selected, a toggle appears to switch between the two engines. Both are Kociemba two-phase; only the implementation differs. Length distribution is essentially identical (±0.1 moves), but generation speed differs by an order of magnitude. Same machine, same tab, post-warmup, 100 random-state scrambles each:
| Metric | cubing.js (WCA) | min2phase-rust | m2p speedup |
|---|---|---|---|
| avg | 20.61 ms | 1.44 ms | 14.3× |
| p50 | 12.42 ms | 1.21 ms | 10.3× |
| p95 | 60.01 ms | 3.49 ms | 17.2× |
| max | 250.63 ms | 18.23 ms | 13.7× |
| avg length | 20.49 | 20.53 | ~ same |
| cold start | ~3 s (with prewarm ~30 ms) | ~120 ms (incl. WASM fetch) | — |
Why not just switch defaults? cubing.js is Lucas Garron's implementation, the ecosystem default, and we keep it. Toggle in the 3×3 picker if you want speed; localStorage persists the choice. Switching clears the relevant pool so the next Generate refills with the new engine.
Why it feels fast: three layers of pool
- prewarm on mount: Landing on /scramble/gen kicks off the 333 / 444 / 555 pruning-table build in parallel with the user picking events. The first Generate click no longer eats a ~3 s cold start.
- cubing.js immediate prefetch: We set scramblePrefetchLevel: 'immediate' so the next scramble starts solving the instant the previous one resolves (default is 1 s idle). Click-click-click feels free.
- App-level pool (cubingScramble.ts): Each event keeps N pre-generated scrambles. Pop one, schedule a refill; 4×4 pool = 25, 5×5 = 5, others = 3.
- Comp-only per-config pool (TNoodleMode): While configuring events / rounds / sets, the page prefetches "exactly enough" in the background. Generate then becomes mostly a pool drain.
See also
- 5×5 scramble methods — random-move vs random-state, plus the 5 phases of the cube555 daemon.
- CFOP scramble analyzer — feed one 3×3 scramble, see optimal cross / F2L lengths per step.
- Solver demo — Kociemba two-phase running visually in the browser.
- cubing.js — Lucas Garron's in-browser cubing stack; WCA + 5 twizzle non-WCA events flow through it.
- cs0x7f/csTimer — Source of the 31 non-WCA puzzle scramble engines (GPLv3), vendored at tools/cstimer-scramble/.
- RuiminYan/min2phase-rust — This site's 3×3 alt engine. Rust port of cs0x7f's Java min2phase, WASM 117 KB, ~20% faster than the Java original. GPL-3.0.
- WCA Regulation §4: Scrambling — the source of competition scramble rules (per-event length, random-move vs random-state allowances).