Skip to content

A Rubik's Cube solver, based on the kociemba's two-phase-solver

Notifications You must be signed in to change notification settings

simongalasso/rubik

Repository files navigation

rubik

A Rubik's Cube solver, written in Rust
This is a 42 school project [Final grade: 115%]


Kociemba's TwoPhaseSolver mind healthier version

We actually tried to simplify the two phase solver algorihm. Know that we did not implemented every optimisation features for sanity so we lack perfs compared to the base version. Some features still need to be simplified, it will be done in further version.

In this version we stops at the first found solution (rapidity criteria from school subject), so we used a statistic config for being on the better solution area on the tree ! (MAX_P1_DEPTH: 10, MAX_P2_DEPTH: 12)


Demo


Setup

If you do not have Rust

> curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
> export PATH=$PATH:$HOME/.cargo/bin

Then you can build the project

> cargo build --release

To setup the server with docker, you can launch:

> docker-compose up

You can then access localhost:8080


Usage

> ./target/release/solver [FLAGS] [OPTIONS] [input_sequence]

Flags

-h, --help            Prints help information
-V, --version         Prints version information
-v, --visualisator    enable the visualisator

Options

-m, --mode <speed_selection>    speed selection, choose from 'slow', 'normal' or 'fast'

Args

<input_sequence>    The sequence to shuffle a rubik (random if empty)

Sequence format

An action is defined by a face and a rotation

U -> up
F -> front
R -> right
D -> down
B -> back
L -> left

nothing -> turn right
' -> turn left
2 -> half rotation

For example: F U2 B' L' D' means "turn front to right, half rotation on up face..."

Commands

Return | launch the sequence

spacebar | pause the autorotation

ESC | close the visualisator


Contributors


Simon Galasso


Nicolas Viénot