1.0.0 • Published 3 years ago

cuberyl v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

cuberyl

Cuberyl (kjúːberəl) is a Javascript library to simulate NxNxN cube puzzle.

Until now N = 3, 4, 5.

Features

  1. Judge whether a cube is solved or not
  2. Judge a given algorithm is a valid 3-style of edge/corner part

Examples

Example 1 (code: ./examples/ex1.js)

const {Cube} = require('cuberyl');

// 3x3x3 cube
const cube = new Cube(3);
console.dir(cube.isSolved()); // true

cube.move("U R'");
let cnt = 1;
const isSolved = cube.isSolved(); // false
console.dir(`${cnt} ${isSolved}`);

while(!cube.isSolved()) {
    cube.move("U R'");
    cnt += 1;
    const isSolved = cube.isSolved(); // false but last time.
    console.dir(`${cnt} ${isSolved}`);
}

// => 1 false
// => 2 false
// ...
// => 63 true

Example 2 (code: ./examples/ex2.js)

const {Algorithm333} = require('cuberyl');

const alg = new Algorithm333("U R D R' U' R D' R'");
const isValidThreeStyle = alg.isValidThreeStyleCorner('UBL', 'UBR', 'RBD');

if (isValidThreeStyle) {
    console.log('OK'); // => OK
}
1.0.0

3 years ago

0.0.8

3 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago