@faztasio/rubikscube
v1.0.1
Published
A virtual Rubik's cube made with JavaScript.
Downloads
5
Readme
Rubik's Cube
A Rubik's Cube simulator written in TypeScript (Node.js) for the terminal.
npm i --save @faztasio/rubikscube
const cubelib = require('rubikscube');
const cube = cubelib.createCube();
cubelib.exec(cube, 'R2 L2 F2 B2 D2 U2');
cubelib.render(cube);
Currently only supports the 3x3 Rubik's Cube. Support for larger and smaller cubes may or may not be added in the future.
API
Import
// TypeScript
import * as cubelib from 'rubikscube';
// Plain JavaScript
const cubelib = require('rubikscube');
Create a Cube
const mainCube = cubelib.createCube();
Execute an Algorithm
cubelib.exec(mainCube, `R U R' U'`);
Render to Terminal
cubelib.render(mainCube);