npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wca-scramble-to-matrix

v0.1.1

Published

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 m

Downloads

7

Readme

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!