Coder Social home page Coder Social logo

cubing.rs's Introduction

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

cubing.rs's People

Contributors

dependabot[bot] avatar lgarron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cubing.rs's Issues

Use exported error types

Right now, we use a variety of error types. We should consolidate them into a few, such as:

  • For Alg: ParseError (for the move "2")
  • For KPuzzle: UnknownMoveError (for the move "T" on 3x3x3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.