#puzzle #solving #rubik #wca

cubing

Features from cubing.js in Rust

47 releases

0.13.10 Nov 1, 2024
0.13.7 Oct 30, 2024
0.13.0 Jan 15, 2024
0.12.4 Dec 26, 2023
0.1.2 May 3, 2021

#2 in #rubik

Download history 1/week @ 2024-09-17 284/week @ 2024-09-24 357/week @ 2024-10-01 138/week @ 2024-10-08 261/week @ 2024-10-15 28/week @ 2024-10-22 764/week @ 2024-10-29 102/week @ 2024-11-05 11/week @ 2024-11-19 71/week @ 2024-11-26 11/week @ 2024-12-03 162/week @ 2024-12-10 18/week @ 2024-12-17 62/week @ 2024-12-24 29/week @ 2024-12-31

282 downloads per month
Used in 3 crates

MPL-2.0 license

120KB
2.5K SLoC

cubing.rs

Features from cubing.js in Rust.

Structure

See https://docs.rs/cubing/latest/cubing/ for Rust docs.

A subset of the cubing.js API is implemented under:

  • cubing::alg
  • cubing::kpuzzle
  • cubing::puzzles

Most applications will use str.parse::<Alg>() and KPuzzle as entry points into the API:

use cubing::{alg::parse_alg, puzzles::cube3x3x3_kpuzzle};

pub fn main() {
    let kpuzzle = cube3x3x3_kpuzzle();
    let default_pattern = kpuzzle.default_pattern();

    let input_alg = parse_alg!("R U R' F' U2 L' U' L F U2");

    let input_pattern = default_pattern
        .apply_alg(&input_alg)
        .expect("Input alg is not valid for puzzle.");
    println!(
        "The following alg {} the puzzle to its original pattern (including center orientation): {}",
        if default_pattern == input_pattern { "returns" } else { "does NOT return" },
        input_alg,
    )
}

Development

This repository contains a port of f2lfast that is useful for exercising functionality (although it's not yet at full speed):

cargo run --example f2lfast -- --scramble "U2 F2 U' L' U L D2 F D2 B' D2 B D2 L2 B L2 F"

Run tests using:

make test

Dependencies

~1.5–2.4MB
~50K SLoC