Skip to content

MikeCroall/rusty-puzzle-cube

Repository files navigation

Rusty Puzzle Cube

An experimental implementation of simple puzzle cubes in Rust

rust-ci lib coverage ui coverage

Puzzle Cube GUI Crate

Experimental, still a work in progress, etc.

Cube in Cube in Cube (3x3x3 algo only on multiple cube sizes)

Cube in Cube in Cube 3D 3x3x3 screenshot Cube in Cube in Cube 3D 4x4x4 screenshot Cube in Cube in Cube 3D 10x10x10 screenshot Shuffled 3D 10x10x10 screenshot

Controls

Click and drag along the edge of a face to perform a rotation

Unreasonable mode simply changes the maximum cube size from 100 to 2000

Shuffle will make 10n moves on an n x n x n cube

Some controls are removed on the WASM target

Controls for the 3D renderer

Building Puzzle Cube GUI Crate for web

Build command written from inside the web dir

npx wasm-pack build "../puzzle-cube-ui" --target web --out-name web --out-dir ../web/pkg

Files built into web/pkg/, which can be hosted by

npm run serve

Then visit http://localhost:8080

Puzzle Cube Lib Crate Demo

Demos of basic 3x3x3 notation being parsed and applied to a newly created cube

Cube in Cube in Cube

let mut cube = Cube::create(3);
let sequence = "F R' U' F' U L' B U' B2 U' F' R' B R2 F U L U";
perform_3x3_sequence(sequence, &mut cube).unwrap();
print!("{cube}");

Cube in Cube in Cube output screenshot

Checkerboard Corners

let mut cube = Cube::create(3);
let sequence = "R2 L2 F2 B2 U2 D2";
perform_3x3_sequence(sequence, &mut cube).unwrap();
print!("{cube}");

Checkerboard Corners output screenshot

Unique Cubies and Large Cubes

Large cubes can be created by providing a larger side length, and cubies can each be given a unique character to keep track of exactly where they move as moves are applied

Note that side length is limited to a maximum of 8 when using unique characters to avoid leaving the basic ASCII range (and trying to use the DEL control code in a cubie)

let mut cube = Cube::create_with_unique_characters(8.try_into()?);
print!("{cube}");

Big Cube and Unique Cubie output screenshot

Note that notation currently only supports 3x3x3-applicable moves. For example, rotating only the center column of a 5x5x5, or the 2nd column of a 4x4x4 is currently impossible with notation.

About

An experimental implementation of simple puzzle cubes in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages