Skip to content
/ Qubes Public

A small, simple and not well optmized python library to tinker with rubiks cubes of any size.

Notifications You must be signed in to change notification settings

leoli51/Qubes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Qubes

A small, simple and not well optmized python library to tinker with rubiks cubes of any size.

How to use

Create a standard 3x3x3 cube:

cube = Cube()
print(cube) #Should print out the cube colored and well formatted!

To create a NxNxN cube you can simply provide N as the constructor argument:

N = 10 #whatever you like
cube = Cube(N)

Moves are identifies by a string of 2 characters: The first character identifies the rotation axis.
The second character identifies the row/column to rotate.
Example : 'X0' or 'Y2'
You can have a list of all possible move names :

cube = Cube()
print(cube.move_names)

To make a move you can use the following method:

cube = Cube()
cube.move('X0') #Applies the X0 move to the cube 1 time
cube.move('Z2', 3) #Applies the Z2 move to the cube 2 times
cube.move('Y1', -2) #Applies the Y1 move to the cube 2 times in the opposite direction

You can also define an entire moveset and then apply it to the cube.
A moveset is defined as a list of tuples of this form : (move, amount).
Example:

[('X0', 1), ('Y0', 1), ('Z2', 3)]

The method cube.apply_moveset(moveset) applies the moveset to the cube.

Hope this may help

Visualization

About

A small, simple and not well optmized python library to tinker with rubiks cubes of any size.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages