Skip to content

cubing/min2phase.js

 
 

Repository files navigation

min2phase.js

A JS package for Chen Shuang's Kociemba-based 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 {parse, algToString} from "alg"
import {KPuzzle, Puzzles} from "kpuzzle"
import min2phase from "min2phase"

const puzzle = new KPuzzle(Puzzles["333"]);
puzzle.applyAlg(parse("R U R' U R U2 R'"));

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

const solution = await min2phase.solve(puzzle.state);
console.log(algToString(solution));

Use multiple web workers

import {OffThreadMin2Phase} from "min2phase"

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

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

// Workers are both ready to solve.

About

A JS package for Chen Shuang's Kociemba-based min2phase 3x3x3 solver.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 88.6%
  • TypeScript 9.9%
  • Other 1.5%