Skip to content

githubman2718/Rubiks-Explore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 

Repository files navigation

This way my first ever project in python. The code may be sloppy, but it runs well!

Rubik's Library

This project provides a library that supports the creation and manipulation of Rubik's cubes of arbitrary length and spacial dimension. The cubes are represented as numpy arrays. The library can be used to develop and test new algorithms for solving the cube and to investigate its properties. This project requires two cube datasets which are available for download at my dropbox.

Some essential terminology:
half turn metric
quarter turn metric

Class Cube(length=3, dim=3)
Creates a cube of the specified length and spacial dimension.

rotate(axis, index, k=1)
Rotates the cube by k quarter turns along the specified axis and index.
0<=axis<dim
0<=index<len

scramble([n]):
Randomly rotates the cube n times. If no argument is passed, the cube is undergoes random rotation 10*len*dim times.

is_same_as(target):
Returns True if the source cube is identical to the target cube. Returns False if the source cube is not identical to the target cube

solved():
Returns a boolean value to indicate if the cube is in the solved position.

ID():
Reversibly maps the cube to a string that uniquely identifies it.

assume_ID(ID):
The cube assumes the position associated with the passed string. This is the inverse of the ID function.

hdepth():
Returns the depth of the cube under the half turn metric. Only works for the 2x2x2 cube.

qdepth():
Returns the depth of the cube under the quarter turn metric. Only works for the 2x2x2 cube.

hless():
Returns the list of rotations that take the cube nearer to solution the half turn metric. Only works for the 2x2x2 cube. Each rotation takes the form (axis, index, k).

qless():
Returns the list of rotations that take the cube nearer to solution the quarter turn metric. Only works for the 2x2x2 cube. Each rotation takes the form (axis, index, k).

hsame():
Returns the list of rotations that take the cube to another position of the same depth under the half turn metric. Only works for the 2x2x2 cube. Each rotation takes the form (axis, index, k).

qsame():
Returns the list of rotations that take the cube to another position of the same depth under the quarter turn metric. Only works for the 2x2x2 cube. Each rotation takes the form (axis, index, k).

hgreater():
Returns the list of rotations that take the cube to another position of a greater depth under the half turn metric. Only works for the 2x2x2 cube. Each rotation takes the form (axis, index, k).

hgreater():
Returns the list of rotations that take the cube to another position of a greater depth under the quarter turn metric. Only works for the 2x2x2 cube. Each rotation takes the form (axis, index, k).

qsolve():
Returns a list of rotations (axis, index, k) which solve the cube under the quarter turn metric in the minimum number of moves. Only works for the 2x2x2 cube. Each rotation takes the form (axis, index, k).

hsolve():
Returns a list of rotations (axis, index, k) which solve the cube under the half turn metric in the minimum number of moves. Only works for the 2x2x2 cube. Each rotation takes the form (axis, index, k).

qsolve_to(target):
Returns a set of rotations to bring the source cube to the target cube in the minimum number of moves under the quarter turn metric. Only works for the 2x2x2 cube. Each rotation takes the form (axis, index, k).

hsolve_to(target):
Returns a set of rotations to bring the source cube to the target cube in the minimum number of moves under the half turn metric. Only works for the 2x2x2 cube. Each rotation takes the form (axis, index, k).

qdistance(target):
Returns the distance between the source cube and the target cube under the quarter turn metric.

hdistance(target):
Returns the distance between the source cube and the target cube under the half turn metric.

qrotations(target):
Returns a list of all rotations of the cube under the quarter turn metric.

hrotations(target):
Returns a list of all rotations of the cube under the half turn metric.

The source code and readme for this project are released under CC00 - No rights reserved.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages