NAME
Rubik::Model
VERSION
version 0.94
DESCRIPTION
This module is responsible for persisting the state of the Rubik's cube between rotations of sides , and also it maps the set 1..54 to the facelets of the cube.
Internal structure
There is a 3x3x3 array called C that stores the cubies
C[x][y][z] with x,y,z ranging in 0,1,2
It will contain what cube is in that position
A rotation of the front face at 90 degrees clockwise will be like this
0 , 1 , 2 6 , 3 , 0
3 , 4 , 5 ===> 7 , 4 , 1
6 , 7 , 8 8 , 5 , 2
The following correspondence between C and the faces of the cube :
C[x][y][0] is Front
C[x][y][2] is Back
C[x][0][z] is Up
C[x][2][z] is Down
C[0][y][z] is Left
C[2][y][z] is Right
Each of the cubies will have 1,2,3 facelets visible depending on wether it is a center, a edge or a corner.
reset()
This method will reset the cube by multiplying the current state with its inverse.
By doing that the state of the module will become the identical permutation.
AUTHOR
Stefan Petrea, <stefan.petrea at gmail.com>