skillfed

magiccube

NxNxN Rubik Cube implementation

magiccube v1.2.0 485.9K downloads/30d#6,395 on PyPI36
Permissive license BSD-3-Clause AGING released

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 magiccube

uv

uv add magiccube

poetry

poetry add magiccube

Installing 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

Development Status :: 5 - Production/StableOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

rubik cube solver pythonnxnxn cube implementationcube rotation simulationrubik cube simulatorcube move optimizerrubik cube librarycube state manipulation
simulationpuzzle-solveralgorithm-development

More Mathematics packages