Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/SdazaP/ruTournament/llms.txt

Use this file to discover all available pages before exploring further.

The Scrambles page (/dashboard/tournament/:id/scrambles) is where you produce official WCA scramble sequences for every round of your competition. Rather than relying on an external service, ruTournament embeds the csTimer engine as a browser Web Worker so scrambles are generated entirely on-device — no internet connection required once the app is loaded.

How scramble generation works

On page load, the app spawns a dedicated Worker pointed at /cstimer_module.js. The worker listens for messages that carry a sequential ID, a command (scramble or image), and parameters. Each call returns a promise resolved by a per-message callback stored in callbacksRef. When you trigger generation, the app:
  1. Looks up the WCA event name in the wcaEventMap to get the csTimer puzzle type and scramble length.
  2. Iterates over each group (or a virtual single-group if the round has no groups configured).
  3. Calls getScramble(scType, scLength) for every solve slot, then getImage(text, scType) to render the puzzle-state SVG.
  4. Strips the fixed width/height attributes from the SVG and replaces them with a responsive viewBox so the image scales correctly on all screens.
  5. Assembles ScrambleRecord[] objects and writes them back to the tournament record in IndexedDB via db.tournaments.put().

Scramble count per round

FormatOfficial solvesExtra solvesTotal generated
ao5527
ao3325
Extra scrambles are displayed with a ⚠ prefix and a yellow card border so judges can distinguish them from official sequences.

WCA event map

The following table shows how category names map to csTimer puzzle identifiers. Only categories whose name appears in this map support automatic scramble generation; custom categories display an informational message instead.
const wcaEventMap: Record<string, [string, number]> = {
  '3x3':      ['333',     0],
  '2x2':      ['222so',   0],
  '4x4':      ['444wca',  0],
  '5x5':      ['555wca', 60],
  '6x6':      ['666wca', 80],
  '7x7':      ['777wca', 100],
  '3x3 OH':   ['333',     0],
  '3x3 BLD':  ['333ni',   0],
  '3x3 FM':   ['333fm',   0],
  'Clock':    ['clkwca',  0],
  'Megaminx': ['mgmp',   70],
  'Pyraminx': ['pyrso',  10],
  'Skewb':    ['skbso',   0],
  'Square-1': ['sqrs',    0],
  '4x4 BLD':  ['444bld', 40],
  '5x5 BLD':  ['555bld', 60],
};
The second element of each tuple is the scramble length hint passed to the csTimer engine. A value of 0 tells csTimer to use its default optimal length for that puzzle type; larger values (e.g. 100 for 7x7) request longer move sequences.

ScrambleRecord structure

Each generated scramble is stored as a ScrambleRecord object defined in src/common/db.ts:
interface ScrambleRecord {
  text: string; // the scramble notation string, e.g. "R U R' U' ..."
  svg: string;  // responsive SVG markup showing the resulting puzzle state
}
Records are stored inside the round.scrambles array (for ungrouped rounds) or inside each group.scrambles array (for grouped rounds) within the tournament document in IndexedDB.

Generating scrambles

1

Select a category and round

Use the Categoría and Ronda dropdowns at the top of the page. The dropdowns are populated from all categories registered in the tournament. The round selector lists rounds with their format (ao3/ao5) and a 🏆 indicator for the final round.
2

Check group configuration

If the round has groups configured (via the Group Scheduler), each group receives its own set of scrambles. If no groups exist, a dialog offers two options: generate scrambles without groups (a single sequence for the whole round) or navigate to the Group Scheduler first.
3

Click Generate

Click Generar mezclas. A spinning icon and an inline progress bar (0 %100 %) track completion. The percentage reflects how many individual scramble-plus-image pairs have been computed out of the total.
4

Review and print

Once generated, scrambles appear grouped by group name with a sticky header showing the group’s start/end time slot. Official solves are numbered 1–5 (or 1–3); extras are labelled E1, E2.
Larger puzzles take longer to compute. 6x6 and 7x7 scrambles may take several seconds each because their random-state solvers require more computation. The progress bar advances solve-by-solve, so you will see incremental updates rather than a long pause.

Clearing scrambles

If you need to replace the current set of scrambles, click the Limpiar Todo button (red, with a trash icon) that replaces the Generate button once scrambles exist. A confirmation modal asks you to confirm before all scrambles arrays for every group in that round are set to [] and persisted to IndexedDB.
Clearing scrambles removes all sequences for every group in the selected round simultaneously. If competitors have already begun solving with the current scrambles, do not clear them — results are tied to the scramble set used during the attempt.
The Generate and Clear buttons are hidden when the tournament status is Finalizado. A lock badge is displayed instead, indicating that scramble data is permanently preserved.

Build docs developers (and LLMs) love