{"id":9913,"library":"magiccube","title":"MagicCube","description":"MagicCube is a Python library providing an NxNxN Rubik's Cube implementation. It allows for cube manipulation, scrambling, and solving (including Kociemba's algorithm). The current stable version is 1.2.0, with ongoing development reflected in beta releases, though stable releases are less frequent.","status":"active","version":"1.2.0","language":"en","source_language":"en","source_url":"https://github.com/trincaog/magiccube","tags":["rubikscube","puzzle","algorithm","solver","3d"],"install":[{"cmd":"pip install magiccube","lang":"bash","label":"Install stable release"}],"dependencies":[],"imports":[{"note":"As of v1.2.0, key public objects like `Cube` are directly exposed in the top-level `magiccube` namespace. Direct import is preferred.","wrong":"from magiccube.cube import Cube","symbol":"Cube","correct":"from magiccube import Cube"},{"note":"While `Cube` is top-level, other related classes like `Move` remain in their submodules.","symbol":"Move","correct":"from magiccube.cube import Move"},{"note":"`KociembaSolver` and other solver-related classes are found within the `magiccube.solver` submodule.","symbol":"KociembaSolver","correct":"from magiccube.solver import KociembaSolver"}],"quickstart":{"code":"from magiccube import Cube\nfrom magiccube.cube import Move\nfrom magiccube.solver import KociembaSolver\n\n# Create a 3x3x3 cube\nc = Cube(3)\n\n# Scramble the cube\nc.scramble(count=25)\nprint('Scrambled cube:')\nprint(c)\n\n# Get facelet colors in Kociemba format\nkociemba_colors = c.get_kociemba_facelet_colors()\nprint(f'Kociemba facelet colors: {kociemba_colors}')\n\n# Solve the cube using Kociemba's algorithm\nsolver = KociembaSolver(c)\nsolution = solver.solve()\nprint(f'Solution: {solution}')\n\n# Apply the solution to verify\nc.rotate(solution)\nprint('Solved cube:')\nprint(c)\nassert c.is_solved()\n","lang":"python","description":"This quickstart demonstrates how to instantiate a cube, scramble it, retrieve its state in Kociemba format, solve it using the Kociemba solver, and apply the solution."},"warnings":[{"fix":"Update rotation strings to use SiGN notation. For example, change 'R3' to 'R'' or 'R U R2' to 'R U R2' where individual move counts are 1 or 2.","message":"Rotation notation changed in v1.2.0 to align with SiGN notation. This constrains move counts to a maximum of 2 (e.g., 'U', 'U2', 'U' for prime). Moves like 'U3' are now invalid.","severity":"breaking","affected_versions":">=1.2.0"},{"fix":"Refactor imports to `from magiccube import Cube` for top-level objects where applicable, following the library's new structure.","message":"Public objects like `Cube` are now exposed directly in the `magiccube` top-level namespace. Old imports like `from magiccube.cube import Cube` will still work but `from magiccube import Cube` is the new preferred way.","severity":"breaking","affected_versions":">=1.2.0"},{"fix":"Ensure your development environment uses Python 3.9 or newer. Upgrade your Python interpreter if necessary.","message":"The minimum Python version was raised to 3.9 in v1.1.0.","severity":"breaking","affected_versions":">=1.1.0"},{"fix":"If your code relies on a specific initial orientation, explicitly set it or adjust your expectations of the cube's state after initialization.","message":"The default cube orientation was changed in v1.0.0 to match WCA scrambling orientation. This may affect algorithms or tests that implicitly relied on the previous default orientation.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Change the import statement to `from magiccube import Cube`.","cause":"Attempting to import `Cube` from `magiccube.cube` after the v1.2.0 change which moved `Cube` to the top-level `magiccube` namespace, and some environments might not correctly resolve the old path.","error":"AttributeError: module 'magiccube.cube' has no attribute 'Cube'"},{"fix":"Rewrite the move using SiGN notation (e.g., 'R''' or 'R' instead of 'R3'). For a 'U3' equivalent, use 'U'' or 'U PRIME'.","cause":"Using a move string with a count greater than 2 (e.g., 'R3') after the v1.2.0 update to SiGN notation.","error":"ValueError: Invalid move 'R3'. Move count must be 1 or 2 for SiGN notation. (Got 3)"},{"fix":"Upgrade your Python environment to version 3.9 or later. You can use `pyenv` or `conda` to manage multiple Python versions.","cause":"Running `magiccube` v1.1.0 or newer with a Python interpreter older than 3.9.","error":"RuntimeError: This library requires Python 3.9 or newer. You are running 3.X.Y"}]}