• Welcome to SpeedSolving.com — the world’s largest puzzle community!

    You’re currently browsing as a guest, which means you have limited access to discussions, resources, member profiles, and community features.

    Join 50,000+ cubers and puzzle enthusiasts from around the world to ask questions, share solves, improve faster, and be part of the community.

    Registration is free, fast, and easy — create your account today.

    Already a member? Log in here to hide this message and start participating.

Cube Solver Python Package

itsdaveba

Member
Joined
Jul 9, 2025
Messages
5
Location
United Kingdom
Hello everyone,

As a practice project for building a Python package, I have created a Cube Solver in Python that implements both the Kociemba and Thistlethwaite algorithms. It’s currently a command-line interface (no graphics just yet, sorry), but I plan to add a GUI in the future.

All you need is Python >= 3.9, and it should work on Windows, macOS, and Linux. To install it, run the following command in your terminal:

Code:
pip install cube-solver

Once installed, you can solve any 3x3 cube using a command like the one below (this example solves the superflip):

Code:
cube solve WBWOWRWGWOWOBOGOYOGWGOGRGYGRWRGRBRYRBWBRBOBYBYGYOYRYBY

For more detailed information about the command-line and cube representation, check out the GitHub repo: https://github.com/itsdaveba/cube-solver

The first time you run the solver, it will take about 5 minutes to generate the tables needed to solve the cube. While Python isn’t the fastest language, it's very popular and easy to use. To speed things up, the package uses C internally to build the tables for faster execution. There’s also detailed documentation available here: https://cube-solver.readthedocs.io

For those interested in the programming side (or in learning some programming by combining Python and the Rubik's Cube), you can also use the Cube Solver in your own code, see an example here. You also might be interested in checking the documentation for the Cube, Maneuver and BaseSolver modules, as you can do some interesting stuff with them :)

Please let me know if you try it out. I would love to hear your thoughts and any feedback you might have. Thanks!
 
Hello everyone,

As a practice project for building a Python package, I have created a Cube Solver in Python that implements both the Kociemba and Thistlethwaite algorithms. It’s currently a command-line interface (no graphics just yet, sorry), but I plan to add a GUI in the future.

All you need is Python >= 3.9, and it should work on Windows, macOS, and Linux. To install it, run the following command in your terminal:

Code:
pip install cube-solver

Once installed, you can solve any 3x3 cube using a command like the one below (this example solves the superflip):

Code:
cube solve WBWOWRWGWOWOBOGOYOGWGOGRGYGRWRGRBRYRBWBRBOBYBYGYOYRYBY

For more detailed information about the command-line and cube representation, check out the GitHub repo: https://github.com/itsdaveba/cube-solver

The first time you run the solver, it will take about 5 minutes to generate the tables needed to solve the cube. While Python isn’t the fastest language, it's very popular and easy to use. To speed things up, the package uses C internally to build the tables for faster execution. There’s also detailed documentation available here: https://cube-solver.readthedocs.io

For those interested in the programming side (or in learning some programming by combining Python and the Rubik's Cube), you can also use the Cube Solver in your own code, see an example here. You also might be interested in checking the documentation for the Cube, Maneuver and BaseSolver modules, as you can do some interesting stuff with them :)

Please let me know if you try it out. I would love to hear your thoughts and any feedback you might have. Thanks!
hey seems to be really cool! i was thinking of developing a similar library myself! can you please give the resources u used for this? thanks a lot
 
hey seems to be really cool! i was thinking of developing a similar library myself! can you please give the resources u used for this? thanks a lot
Glad that you found it cool! Of course, I mainly used this other libraries:
  • Numpy: used for storing the cube state, transition tables and pruning tables.
  • Typer: for the command-line interface.
Everything else was coded by myself :). Some other resources that are really useful to understand the Kociemba and Thistlethwaite implementations are:
 
Glad that you found it cool! Of course, I mainly used this other libraries:
  • Numpy: used for storing the cube state, transition tables and pruning tables.
  • Typer: for the command-line interface.
Everything else was coded by myself :). Some other resources that are really useful to understand the Kociemba and Thistlethwaite implementations are:
u bet me to it! i was wanting to do this and postponed it like hell lol.
why do u need cli's tho? cant u take the input afterward?
also damm everything else by uu!!! :fire
also thanks for the resources!
 
u bet me to it! i was wanting to do this and postponed it like hell lol.
why do u need cli's tho? cant u take the input afterward?
also damm everything else by uu!!! :fire
also thanks for the resources!
You are welcome!

It’s was just my way of avoiding the user to run a script like this, which should accomplish the same:

Python:
# solve.py
from cube_solver import Cube, Kociemba

cube_representation = input()
cube = Cube(repr=cube_representation)

solver = Kociemba()
solution = solver.solve(cube)
print(solution)

As you can see, the Cube Solver python package follows the Object Oriented Programming paradigm.

Instead of running:

Code:
python solve.py
[CUBE_REPRESENTATION]

The user can just run:

Code:
cube solve [CUBE_REPRESENTATION]

Is that what you were asking? :)
 
You are welcome!

It’s was just my way of avoiding the user to run a script like this, which should accomplish the same:

Python:
# solve.py
from cube_solver import Cube, Kociemba

cube_representation = input()
cube = Cube(repr=cube_representation)

solver = Kociemba()
solution = solver.solve(cube)
print(solution)

As you can see, the Cube Solver python package follows the Object Oriented Programming paradigm.

Instead of running:

Code:
python solve.py
[CUBE_REPRESENTATION]

The user can just run:

Code:
cube solve [CUBE_REPRESENTATION]

Is that what you were asking? :)
ahh that makes sense...
thanks a lot!
 
Back
Top