NxNxN Rubik Cube implementation
Project description
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)
# 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. |
| M M' | Rotation of the center layer on the X axis. |
| E E' | Rotation of the center layer on the Y axis. |
| S S' | Rotation of the center layer on the Z axis. |
| 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.
Project details
Release history Release notifications | RSS feed
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.4.tar.gz
(11.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file magiccube-0.0.4.tar.gz.
File metadata
- Download URL: magiccube-0.0.4.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48e1c8e6996a2a18f19b311535cdfc3b89526a672612f104b7ca9d77c231a832
|
|
| MD5 |
b1921fd56d1262d24653799c0af95cdf
|
|
| BLAKE2b-256 |
18ce55658d4a1840eb5d20a553c1d4a11f4100863200e662acd7f80bebac0dc7
|
File details
Details for the file magiccube-0.0.4-py3-none-any.whl.
File metadata
- Download URL: magiccube-0.0.4-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26d11b0071c42adfe61aaca2cfd168ab46855dfc9e1162ff9eccb26b61e2c766
|
|
| MD5 |
4c2e14d4c2e91af61a6b9796886c0258
|
|
| BLAKE2b-256 |
1c7e815c686abacd21aa6b4e333d0d4e088cd017ff3dff739617f48925c02033
|