https://github.com/trimorphdev/rubikscube
A Rubik's Cube simulator for the terminal made with JavaScript.
https://github.com/trimorphdev/rubikscube
Last synced: 6 months ago
JSON representation
A Rubik's Cube simulator for the terminal made with JavaScript.
- Host: GitHub
- URL: https://github.com/trimorphdev/rubikscube
- Owner: trimorphdev
- License: mit
- Created: 2021-05-06T20:24:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-06T21:00:34.000Z (over 4 years ago)
- Last Synced: 2025-06-27T21:42:21.058Z (6 months ago)
- Language: TypeScript
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rubik's Cube
A Rubik's Cube simulator written in TypeScript (Node.js) for the terminal.
```sh
npm i --save @faztasio/rubikscube
```

```js
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
```ts
// TypeScript
import * as cubelib from 'rubikscube';
```
```js
// Plain JavaScript
const cubelib = require('rubikscube');
```
### Create a Cube
```ts
const mainCube = cubelib.createCube();
```
### Execute an Algorithm
```ts
cubelib.exec(mainCube, `R U R' U'`);
```
### Render to Terminal
```ts
cubelib.render(mainCube);
```