Kewb
Kewb is a library for manipulating and solving the 3x3 Rubiks's cube using Kociemba's two-phase algorithm. There is also a CLI version which showcases most of kewb features.
Please note that this is still a work in progress and the implementation is not yet efficient. The solver does not currently use symmetric reductions, pre-moves, or multi-threaded search.
Usage
Library
See https://docs.rs/kewb/latest/kewb/ for an exhaustive list of APIs provided by kewb.
The solver needs some precomputed data which is represented by the DataTable struct. However, generating it takes some amount of time so it's recommended to write it on the disk or bundle it with the executable. You can use the write_table() function or the table command from kewb-cli to generate the table.
use ;
CLI
By default, there is no timeout, which means the solver will return the first solution it finds. However, by adding a timeout, the solver will continue searching until the timeout has elapsed and return the shortest solution found or nothing. Specifying a lower search depth can result in better solution quality (around 21 to 23 moves), but it can also make the search slower if the depth is less than 20 moves. Nevertheless, it has been proven that all cases can be solved in 20 moves or fewer.
# default values: max = 23, timeout = none, details = false
# default values: state = random, number = 1, preview = false
# generates the table used by the solver
Build
NB: You must have the rust toolchain installed
Clone the repository and run:
# or
Testing
You can run the tests by running:
Todo
- Add Documentation
- More CLI features
- Algorithm optimization
References
-
Two phase algorithm overview: http://kociemba.org/cube.htm
-
Two phase algorithm implementation in python: https://qiita.com/7y2n/items/55abb991a45ade2afa28