# Cube Scramble Generator [](https://github.com/Baggins800/cube_scramble_generator/actions/workflows/rust.yml)
## Overview
Cube Scrambler is a simple yet effective random-move scramble generator API and CLI for 2x2x2, 3x3x3[default], 4x4x4, 5x5x5, 6x6x6 and 7x7x7 Rubik's Cubes, written in Rust. It ensures no two consecutive moves are the same, providing an unpredictable and challenging scramble.
## Functionality
Cube Scrambler's core function, `generate_scramble`, generates a random sequence of moves. The moves are denoted as `R`, `L`, `B`, `F`, `U`, `D`, ` `, `'`, `2` corresponding to Right, Left, Back, Front, Up, Down, none, counter-clockwise (prime), and a 180-degree turn respectively. For the 2x2 only `R`, `F` and `U` is used.
The scramble generator ensures that the same move is not repeated consecutively.
## Building
Navigate to the project directory and build the project using Cargo:
```console
$ cargo build --release
```
## Usage
Enjoy the CLI:
```console
$ ./target/release/cube_scrambler --help
Usage:
./target/release/cube_scrambler [OPTIONS]
2x2x2, 3x3x3, 4x4x4, 5x5x5, 6x6x6 and 7x7x7 Rubik's Cubes scramble generator
Optional arguments:
-h,--help Show this help message and exit
-l,--length LENGTH Set the number of moves of the scramble
-t,--type TYPE Set the cube type (e.g., 2x2, 222, 2x2x2, ..., 7x7,
777, 7x7x7)
$ ./target/release/cube_scrambler # default option is 3x3x3 (with the default 20 moves for it)
U2 D' R2 B U2 B F' U B' R' B U' D' U L2 R B2 D R D2
$ ./target/release/cube_scrambler --type 222 # each puzzle has a different default length
R' U F' R' F' R2 U' F2 U'
```
## Dependencies
This project depends on the `rand` and `argparse` crates. These are specified in the `Cargo.toml` file in the project's root directory.
## Conclusion
Whether you're a beginner or a seasoned Rubik's Cube solver, the Cube scramble generator provides an easy-to-use tool for generating a variety of scrambles. It's flexibility in the number of generated moves allows for a wide range of scramble complexities. Happy cubing!