0.1.1 • Published 11 months ago

wca-scramble-to-matrix v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

wca-scramble-to-matrix

Introduction

wca-scramble-to-matrix is a JavaScript library that provides utility functions for generating matrix representations of various Rubik's Cubes. It supports cubes ranging from 2x2 to 7x7. Each cube-specific function takes a scramble as input and returns a matrix representing the current state of the cube.

Installation

You can install wca-scramble-to-matrix using npm:

npm install wca-scramble-to-matrix

Usage

First, import it as:

const ScrambleToMatrix = require("wca-scramble-to-matrix");

const {
  get222imgmatrix,
  get333imgmatrix,
  get444imgmatrix,
  get555imgmatrix,
  get666imgmatrix,
  get777imgmatrix,
} = ScrambleToMatrix;

2x2 Cube (2x2x2)

The get222imgmatrix function generates a matrix representation of a 2x2 Rubik's Cube.

const scramble = "R U R' U'";
const matrix = get222imgmatrix(scramble);
console.log(matrix);

3x3 Cube (3x3x3)

The get333imgmatrix function generates a matrix representation of a 3x3 Rubik's Cube.

const scramble = "F R U R' U' F'";
const matrix = get333imgmatrix(scramble);
console.log(matrix);

4x4 Cube (4x4x4)

The get444imgmatrix function generates a matrix representation of a 4x4 Rubik's Cube.

const scramble = "Uw Rw2 Fw' U2 Rw2 Fw' U2 Uw' R2";
const matrix = get444imgmatrix(scramble);
console.log(matrix);

5x5 Cube (5x5x5)

The get555imgmatrix function generates a matrix representation of a 5x5 Rubik's Cube.

const scramble = "Uw2 R2 D2 L' F' D2 L D2 R' Uw' L' U2 B' D' L U' Lw2 R D2 Fw";
const matrix = get555imgmatrix(scramble);
console.log(matrix);

6x6 Cube (6x6x6)

The get666imgmatrix function generates a matrix representation of a 6x6 Rubik's Cube.

const scramble = "3Rw2 3Uw' 3Fw 3Rw' 3Uw' 3Fw' 3Rw2 3Uw 3Fw";
const matrix = get666imgmatrix(scramble);
console.log(matrix);

7x7 Cube (7x7x7)

The get777imgmatrix function generates a matrix representation of a 7x7 Rubik's Cube.

const scramble = "3Uw2 3Fw 3Rw' 3Uw' 3Fw' 3Rw2 3Uw2 3Fw 3Rw' 3Uw' 3Fw'";
const matrix = get777imgmatrix(scramble);
console.log(matrix);

Further Enhancements and Possibilities:

The wca-scramble-to-matrix library has potential for further expansion and integration with other tools and functionalities. Here are some ideas for future enhancements:

Support for Additional Puzzles: Currently, the library focuses on 2x2 to 7x7 Rubik's Cubes. Consider extending the library to include other popular puzzles such as Pyraminx, Megaminx, Skewb, Square-1, Clock, and other non-WCA puzzles. This expansion would provide a more comprehensive solution for generating matrix representations of various puzzles.

Integration with Scramble Generation Libraries: Instead of relying solely on external sources for scrambles, the library can be combined with other scramble generation libraries. This integration would allow users to generate the scramble itself directly within the wca-scramble-to-matrix library, providing a seamless and self-contained solution.

Output as SVG Files: In addition to the matrix output, consider adding support for generating SVG files representing the cube's state. This would enable users to obtain visual representations of the cube from the library itself, making it convenient for further analysis, visualization, or integration with other applications.

These are just a few possibilities for expanding the functionality of the wca-scramble-to-matrix library. Your creativity and contributions can play a significant role in shaping the future direction of the project. Feel free to explore these ideas or suggest your own to make the library more versatile, powerful, and user-friendly.

Note:

Please be aware that the wca-scramble-to-matrix library is currently in a premature phase of development. It may not cover all border cases and may produce errors if an incorrect or invalid scramble is provided. While the provided functions aim to generate matrix representations of Rubik's Cubes based on valid scrambles, there might be scenarios where unexpected input can lead to undesired results or exceptions. Therefore, it is important to use the library with caution and ensure that the scrambles provided adhere to the supported formats.

The wca-scramble-to-matrix library specifically supports scrambles generated for the World Cube Association (WCA) puzzles. It is designed to work with scrambles from official sources such as CSTimer or generated by tools like TNoodle that follow the WCA scramble notation. Using non-WCA scrambles or scrambles from incompatible sources may result in errors or unexpected behavior in the matrix generation process.

As the library progresses and matures, efforts will be made to improve error handling and expand the coverage of various edge cases. Your feedback, suggestions, and contributions are highly appreciated in making this library more robust, reliable, and user-friendly. If you encounter any issues, have ideas for enhancements, or would like to contribute to the development of the library, please feel free to open an issue or submit a pull request on the project's GitHub repository. Your involvement can greatly contribute to the overall quality and effectiveness of the library.

Please exercise caution and validate the results obtained from the library in your specific use cases.

Thank you for your understanding, support, and interest in the development of wca-scramble-to-matrix!

0.1.1

11 months ago

0.1.0

11 months ago