CM-Permutation-0.94

NAME

CM::Rubik - Rubik's cube

VERSION

version 0.94

DESCRIPTION

The Rubik's cube is known primarily as a toy puzzle, which has associated the Rubik's cube group. Its generators are the permutations that correspond to clockwise 90 degrees rotations of each of its faces,let's call these: F R B L D U. These are permutations of the set {1..54} if we consider the centers of the faces also(although these are fixed points under the permutations).

The order of the group is 43_252_003_274_489_856_000 , yeah, that's :

Forty-three quintillion two hundred fifty-two quadrillion three trillion two hundred seventy-four billion four hundred eighty-nine million eight hundred fifty-six thousand. But at least it's not infinite right ? :)

There's also a simulator of Rubik's cube written using OpenGL and Perl, using CM::Permutation and CM::Rubik in order to implement the logic of the rotations:

comb(string)

This will give you the permutation which results from multiplying the sequence of transformations in the string. It returns a CM::Permutation object. OBS: you can also find the order(the number of times you make those moves until the cube returns to the position before you started them) using the order() method on the result, so for example:

my $r = CM::Rubik->new;
print $r->comb('FURBL');
60

To understand where the permutations came from I used the following unfolded version of the cube( also called net ), the numbers are labels for the faces of the cubies: