Reference · Cube engine and views
turnCubefunction
The state after one turn.
Import it
import { turnCube } from "@johnmorrisdotca/kyuubu";
Definition
function turnCube(state: string, n: number, move: CubeMove): string
Parameters
| Name | Type | Description |
|---|---|---|
state | string | The sticker-state string in the package’s face order. |
n | number | The cube’s side length. |
move | CubeMove | The turn to apply, name or invert. |
Returns
string
The state after one turn.
Examples
import { parseMove, solvedCube, turnCube } from "@johnmorrisdotca/kyuubu";
const state = solvedCube(3);
const move = parseMove("R", 3)!;
console.log(turnCube(state, 3, move));UUFUUFUUFRRRRRRRRRFFDFFDFFDDDBDDBDDBLLLLLLLLLUBBUBBUBBWhat it prints (run when this page was built)