Skip to content
scrambles
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

scrambles

Puzzle scrambles with the following features:

  • Markov random-state (MRSS) using high-quality randomness, matching WCA standards.
  • Simple and consistent API.
  • Automatic web workers to avoid slowing down web apps.
  • Compatibility with browsers and node (CommonJS or ESM/modules).

Usage

Use as a Promise:

// Using `then`
randomScrambleStringForEvent("333").then((scrambleString) => {
  // Use the result.
});

// Using `await` (in an `async` context)
const scrambleString = await randomScrambleStringForEvent("333");

Full Example

// index.html
<script src="index.js" type="module" defer></script>

<select id="eventID">
  <option value="333" selected>3x3x3</option>
  <option value="444">4x4x4</option>
</select>
<button id="new-scramble">New scramble</button><br>

<div id="scramble-string"></div>
// index.js
import { randomScrambleStringForEvent } from "scrambles";

const eventSelect = document.querySelector("#eventID");
const scrambleStringElem = document.querySelector("#scramble-string");

async function newScramble() {
  scrambleStringElem.textContent += " ⏳";
  const scrambleString = await randomScrambleStringForEvent(eventSelect.value);
  scrambleStringElem.textContent = scrambleString;
}

document.querySelector("#eventID").addEventListener("change", newScramble);
document.querySelector("#new-scramble").addEventListener("click", newScramble);
newScramble(); // Initial scramble

Currently supported events

Event Supported Scramble Filtering
333 βœ… βœ…
222 🚧 🚧
444 βœ… 🚧
555 🚧 🚧
666 🚧 🚧
777 🚧 🚧
333bf 🚧 🚧
333fm 🚧 🚧
333oh βœ… βœ…
clock βœ… βœ…
minx βœ… βœ…
pyram 🚧 🚧
skewb 🚧 🚧
sq1 🚧 🚧
444bf 🚧 🚧
555bf 🚧 🚧
333mbf 🚧 🚧
333ft 🚧 🚧
fto 🚧 🚧
kilominx 🚧 🚧

Implementation

See docs/implementation.md for information about how this library is implemented.

Acknowledgments

This projects includes code from

About

πŸ”πŸ”€ Javascript Solver/Scrambler Suite

Topics

Resources

License

Packages

No packages published