Skip to main content

MagicCube: A NxNxN Rubik Cube implementation

A fast implementation of the Rubik Cube based in Python 3.x.

Allows creation of cubes of various sizes (2x2x2, 3x3x3, 4x4x4, 6x6x6, ...., 100x100x100).

Has a simple (not so efficient) solver for the 3x3x3 cube.

Installation

pip install magiccube

Usage

import magiccube

# 3x3x3 Cube
cube = magiccube.Cube(3)
print(cube)

Cube

# Rotate the cube
cube.rotate("R' L U D' F B' R' L")

# Solve the 3x3x3 cube
solver = BasicSolver(cube)
solver.solve()

# 6x6x6 Cube
cube = magiccube.Cube(6)
cube.rotate("Rw' Lw 3Uw'")

Examples

See examples folder.

Supported Moves and Notation

Basic moves

Move
L L' Clockwise/Counterclockwise cube rotation of the LEFT face.
R R' Clockwise/Counterclockwise cube rotation of the RIGHT face.
D D' Clockwise/Counterclockwise cube rotation of the DOWN face.
U U' Clockwise/Counterclockwise cube rotation of the UP face.
F F' Clockwise/Counterclockwise cube rotation of the FRONT face.
B B' Clockwise/Counterclockwise cube rotation of the BACK face.

Advanced Moves

Move
X X' Cube rotation on X axis. X is the axis that points from LEFT to the RIGHT face.
Y Y' Cube rotation on Y axis. Y is the axis that points from DOWN to the UP face.
Z Z' Cube rotation on Z axis. Z is the axis that points from BACK to the FRONT face.
Fw Fw' Wide rotation of 2 layers.
3Fw 3Fw' Wide rotation of 3 layers.
3F 3F' Rotation of the 3rd layer.

Cube Coordinates

Cube coordinates are expressed as a tuple of x,y,z.

(0,0,0) is the piece on the LEFT,DOWN,BACK corner.

In a 3x3x3, (2,2,2) is the piece on the RIGH,UP,FRONT corner.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

magiccube-0.0.2.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

magiccube-0.0.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file magiccube-0.0.2.tar.gz.

File metadata

  • Download URL: magiccube-0.0.2.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for magiccube-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b9bf2176c3cba9e7ee2ef07f0ac84ff67b00fdc2ad6442f8e2bee49689b8becf
MD5 747714bacb48bcc3beed46337e0256a2
BLAKE2b-256 2e8ccd6c283e7f57caf09ad62f7b1128fbc87180523067d52c69c59b875e3686

See more details on using hashes here.

File details

Details for the file magiccube-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: magiccube-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for magiccube-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b6fe9d666448df39f5d82eebe970db62e299c8bcf8d30296b673b2c9dddf5042
MD5 b7db8a6150533ccb94a65813a2af4554
BLAKE2b-256 813276d77a31d4bc574b3e985d7d192fb672e6643615d6f9ca27b103255fc003

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.0

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

0.3.0

2 files

0.2.10

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

This release

0.0.2 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page