@biohuns/min2phase

Template for interacting with cubing JS libraries.

Usage no npm install needed!

<script type="module">
  import biohunsMin2phase from 'https://cdn.skypack.dev/@biohuns/min2phase';
</script>

README

@biohuns/min2phase.js

This JS package is fork from cubing/min2phase.js. For Chen Shuang's Kociemba-based cs0x7f/min2phase 3x3x3 solver.

Usage

The default import uses automatically uses web workers if they are available (all modern browsers) and does computation on the thread if not (e.g. node.js).

import { defaultOffThread as min2phase } from "@biohuns/min2phase";
import { algToString } from "alg";

// Optional: pre-initialize ahead of time.
min2phase.initialize();

const solution = await min2phase.randomCube();
console.log(algToString(solution));

Use multiple web workers

import { OffThreadMin2Phase } from "@biohuns/min2phase";

const worker1 = new OffThreadMin2Phase();
const worker2 = new OffThreadMin2Phase();

Promise.all([worker1.initialize(), worker2.initialize()]);

// Workers are both ready to solve.