Rubiks Cube/Tuple: Difference between revisions
From charlesreid1
| Line 41: | Line 41: | ||
=4x4 Rubiks Cube Representation= | =4x4 Rubiks Cube Representation= | ||
<pre> | |||
01 02 03 04 | |||
05 06 07 08 | |||
09 10 11 12 | |||
13 14 15 16 | |||
17 18 19 20 33 34 35 36 49 50 51 52 65 66 67 68 | |||
21 22 23 24 37 38 39 40 53 54 55 56 69 70 71 72 | |||
25 26 27 28 41 42 43 44 57 58 59 60 73 74 75 76 | |||
29 30 31 32 45 46 47 48 61 62 63 64 77 78 79 80 | |||
81 82 83 84 | |||
85 86 87 88 | |||
89 90 91 92 | |||
93 94 95 96 | |||
</pre> | |||
=Flags= | =Flags= | ||
Revision as of 08:24, 10 January 2018
Notes on Tuple Representation of Rubiks Cube
Let's first explain what we mean when we talk about a tuple representation of a cube, and why this is useful.
Tuple Representation
A tuple representation means, we are representing one possible permutation of the Rubik's Cube using a tuple, ideally a tuple of N items arranged in some particular way.
Now, if we think about how a 3x3 Rubik's Cube or 4x4 Rubik's Revenge is mechanically constructed, we see that the cube consists of:
Rubik's Cube: 26 total (mechanical) pieces
- 8 corner pieces
- 12 edge pieces
- 6 center pieces
Rubik's Revenge: 56 total (mechanical) pieces
- 8 corner pieces
- 24 double-edge pieces (12 left-hand, 12 right-hand)
- 24 center pieces
However, it is important to note that we are not trying to find the minimal representation of the Rubik's Cube, we are simply trying to find a unique representation of a Rubik's Cube. Representing faces requires more information than representing pieces, but it is a lot simpler and accomplishes what we need:
- The 3x3 Rubik's Cube has 9 squares on each face, and 6 faces, for a total of 36 squares.
- The 4x4 Rubik's Revenge has 16 squares on each face, and 6 faces, for 96 total squares.
Now, if we were looking for a minimal representation, we would utilize the fact that some of these squares are innately linked (for example, the three faces representing a corner piece are always positioned in the same way relative to one another, even though they may move relative to the rest of the pieces on the cube).
However, we simply want a unique representation, so we can represent the state of any 3x3 Rubik's Cube using a 36-tuple, or the state of any 4x4 Rubik's Revenge using a 96-tuple.
Why A Tuple Representation
Finding a tuple representation enables us to study the properties of various move sequences and understand how the cube works.
For example, if we repeatedly apply any sequence of moves to a Rubik's Cube, eventually it will return back to the solved state. To predict how many times a sequence must be applied to a cube to return to the solved state, we can use techniques demonstrated by Donald Knuth in Volume 3 of The Art of Computer Programming (see AOCP) to derive a permutation algebra, factor permutations into cycles, and find the sequence length via the lcm of each cycle length.
See also: https://github.com/charlesreid1/rubiks-cycles
Tuple representation: https://github.com/charlesreid1/rubiks-cycles/blob/master/tup.py
4x4 Rubiks Cube Representation
01 02 03 04
05 06 07 08
09 10 11 12
13 14 15 16
17 18 19 20 33 34 35 36 49 50 51 52 65 66 67 68
21 22 23 24 37 38 39 40 53 54 55 56 69 70 71 72
25 26 27 28 41 42 43 44 57 58 59 60 73 74 75 76
29 30 31 32 45 46 47 48 61 62 63 64 77 78 79 80
81 82 83 84
85 86 87 88
89 90 91 92
93 94 95 96
Flags