kpuzzle
. Permutations are encoded using lexicographic order.
Orientations are encoded as numbers in base 2 (edges), 3 (corners), or 4
(centers).
Components are encoded in the following order:
Component ID | Meaning | Valid Range | # of bits |
EP | edge permutation | 0 to 12! - 1 | 29 bits |
EO | edge orientation | 0 to 212-1 | 12 bits |
CP | corner permutation | 0 to 8! - 1 | 16 bits |
CO | corner orientation | 0 to 38-1 | 13 bits |
PO_U | puzzle orientation (see below) | 3 bits | |
PO_L | 2 bits | ||
MO_Q | whether center ("middle") orientation is supported |
0 to 1 | 1 bit |
MO | center ("middle") orientation | 0 to 46-1 | 12 bit |
EP | |||||||||||||||
EP (continued) | EO | ||||||||||||||
EO (continued) | CP | ||||||||||||||
CP (continued) | CO | ||||||||||||||
CO (continued) | PO_U | PO_L | MO_Q | MO | |||||||||||
MO |
Each component is stored with binary bits contiguously from high to low. Example: the high bit of EP is at bit index 0 (first bit of the first byte), and the low bit is at index 28 (5th bit of the third byte).
If puzzle orientation is not encoded:
0b111
.
If center orientation is not encoded:
0b0
.
ULFRBD
).
ULFRBD
, skipping the
centers currently on U and D).
The other components are encoded relative to centers. That is, reorienting the puzzle changes PO_U and PO_L, but does not affect any other components.
Apply z y'
to a solved cube. Now:
L
center has moved to U
.
L
is at (zero-indexed) position 1 in
ULFRBD
, so PO_U =
1
B
center has moved to L
.
L
and R
centers are on
U
and D
(respectively), so remove
L
and R
from ULFRBD
to get
UFBD
.
B
is at (zero-indexed) position 2 in
UFBD
, so PO_L =
2