An ultra-fast, cross-platform Rubik's Cube solver engine built with modern C++17, implementing Kociemba's Two-Phase Algorithm.
- ⚡ High Performance: Fast and resource-efficient core implementation.
- 🌐 Multi-Language: Native bindings for Python, Rust, Haskell, and WebAssembly/TypeScript.
- 📦 Cross-Platform SDK: Ships C dynamic/static libraries, Swift module (
Cube.framework), and interactive CLI (icube). - 🛠️ Standalone: Zero external third-party dependencies.
| Language | Directory & Guide | Package |
|---|---|---|
| Python | bindings/python | cube-python |
| Rust | bindings/rust | cube-rust |
| Haskell | bindings/haskell | cube-hs |
| TypeScript | bindings/wasm | @coshz/jscube |
# Launch interactive solver
icube
# Or solve directly via state string
icube solve "UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB"#include <cube/cube.hh>
#include <iostream>
#include <string_view>
int main()
{
std::string_view cube = "FFLBURBURUUFRRRDDBUFBUFDFBRUDFBDFLLRDLLULLBRRULLFBBDDD";
auto sol = cube::solve(cube);
if(sol.is_success()) {
std::cout << sol.maneuver << std::endl;
if(cube::cubeId == cube::apply_maneuver(sol.maneuver, cube))
std::cout << "solution verified\n";
else
std::cout << "wrong solution\n";
} else {
std::cerr << "solve failed: " << cube::to_string(sol.status) << std::endl;
}
}example/eg_c- C, built with makeexample/eg_cpp- C++, built with CMake
- CMake 3.28+
- C++17 compatible compiler (Clang, GCC, MSVC)
- Ninja (Optional, recommended)
# Configure & build core SDK
cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
# Install C++ artifacts to system default path
cmake --build build --target install.
├── amalg/ # Amalgamated C++ source (single-file distribution)
├── asset # Project resources (snapshots, benchmark reports)
├── app/ # Source code for command-line tool `icube`
├── bindings/ # Language bindings
├── bench/ # Source code for benchmark
├── cmake/ # CMake templates and modules
├── dev/ # Development scripts
├── include/ # Public headers
├── src/ # Core Two-Phase Algorithm implementation
└── test/ # Testing
MIT © coshz
