A small, simple and not well optmized python library to tinker with rubiks cubes of any size.
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.