magiccube
NxNxN Rubik Cube implementation
What it is and what it does
MagicCube is a Python library for creating and manipulating Rubik cubes of any size from 2x2x2 up to 100x100x100. It provides fast rotation operations using numpy, making it suitable for cube simulations and algorithm testing. The library supports standard cube notation (L, R, U, D, F, B moves and their variants) plus advanced extensions like wide rotations and layer-specific moves.
The package includes a BasicSolver that can solve 3x3x3 cubes using the beginner method, and a move optimizer that simplifies move sequences by eliminating redundant rotations, converting triple moves to inverses, and removing unnecessary cube rotations. It's designed for developers building cube solvers, simulations, or educational tools.
Use it for:
- Build a Rubik cube solver or algorithm tester by creating cubes and applying move sequences.
- Simulate cube scrambles and track state changes for educational or competitive analysis.
- Optimize move sequences for cube-solving algorithms to reduce the number of rotations needed.
- Generate and validate cube states in Kociemba order for advanced solving techniques.
- Create visualizations or games that require fast cube state manipulation and rotation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
MagicCube implements NxNxN Rubik cubes with fast rotations and includes a solver for 3x3x3 cubes and a move optimizer.
Yes, if you need a fast, permissively licensed Rubik cube library. The low install friction, Production/Stable status, and recent updates make it reliable for simulations and solver development. The aging maintenance signal (474 days since last release) is a minor concern for long-term support, but no known vulnerabilities and active repository history suggest stability. Not necessary if you only need basic cube representation without solving or optimization.
Install
magiccube on PyPI
pip
pip install magiccubeuv
uv add magiccubepoetry
poetry add magiccubeInstalling magiccube
Before you install
Low install friction with a pure-wheel distribution and a single runtime dependency on numpy. The package is marked Production/Stable and has received updates as recently as April 2025, though the last commit was September 2025 and the project shows aging maintenance signals.
License in practice
BSD-3-Clause is a permissive license that allows commercial and private use with minimal restrictions, requiring only attribution and inclusion of the license text.
Quickstart
pip install magiccube
import magiccube
cube = magiccube.Cube(3, "YYYYYYYYYRRRRRRRRRGGGGGGGGGOOOOOOOOOBBBBBBBBBWWWWWWWWW")
cube.rotate("R' L2 U D' F B'2 R' L")
from magiccube import BasicSolver
solver = BasicSolver(cube)
solver.solve()
Requires Python 3.9 or later.
Verify before relying
- Whether the BasicSolver works reliably for all 3x3x3 configurations or only specific starting states.
- Performance characteristics and whether the package is suitable for large-scale simulations beyond basic use.
- Whether the move optimizer handles all edge cases or has known limitations in notation parsing.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | aging — 474 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 485,889/month — #6,395 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: magiccube-1.2.0-py3-none-any.whl
Keywords: rubik, cube, solver, Rubik Cube, NxNxN
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
transforms3dConverts between different 3D geometric…
permissive · top 15,000 on PyPI
pyquaternionProvides quaternion representation,…
permissive · top 5,000 on PyPI
xpressPython interface to the FICO Xpress Optimizer…
unclear · top 15,000 on PyPI
cbcboxcbcbox is a self-contained Python distribution…
copyleft · top 15,000 on PyPI
datacubeDatacube provides an integrated gridded data…
permissive · top 15,000 on PyPI
transformationsCalculates 4x4 homogeneous transformation…
permissive · top 5,000 on PyPI
nvidia-cusolverProvides CUDA solver native runtime libraries…
unclear · top 1,000 on PyPI
nvidia-cusolver-cu12Provides CUDA solver native runtime libraries…
unclear · top 1,000 on PyPI
nvidia-cusolver-cu11Provides NVIDIA CUDA solver native runtime…
unclear · top 5,000 on PyPI