Orbit64.Canonical
One token for every cube that looks the same up to turning, mirroring and recoloring.
A pattern is a color state: its identity does not depend on how the cube is
held, mirrored or colored. fromFacelets maps all such cubes to a single
ordinary state token, so string equality is pattern equality.
The definition, in three steps:
- Take the least sticker string of the cube over the 48 symmetries
(rotations and mirrors), each with its colors renamed in order of first
appearance. Strings are compared sticker by sticker in facelet order
U R F D L B, colors as the numbers 0 to 5. This orders sticker strings, not tokens, so it needs 48 images and one encoding. - Rename the colors to the standard scheme. On an odd cube the color in
the center of face
fbecomesf, so the six fixed centers are home and the stored frame is 0. An even cube has no centers: the colors of the corner in the URF slot becomeU R Fin turning order, and the three colors that share no corner with them becomeD L B. - Encode it with
Orbit64.State.encode. A state that is no cube is an error.
No mirroring step is needed after step 2. The renaming depends only on which stickers share a color, and the reachable states are closed under mirroring, so the mirror image of a cube renames to a cube as well.
The token depends only on the string of step 1, so it is invariant, and
distinct color states of different classes get distinct tokens. Mirror images get the
same token: the 48 symmetries include the mirrors. The solved cube of every
size is the token of A repeated.
From the 4x4x4 up, equal-colored pieces need no representative: Orbit64 reads colors, a wing by the ordered pair of colors in its slot and a center orbit as a multiset of colors, so swapping equal-colored pieces changes no color and no token.
The token also depends on the slot convention Orbit64.Net.convention(n)
names (orbit64-Nxn-draft@1), on the sticker order U R F D L B and its
geometry (see FORMAT.md), and on the URF corner. Changing any of them
renames every canonical token, so a stored token should carry the
convention name. This is an addition to the format: tokens that
Orbit64.State.encode writes are unchanged, and the output here is one
of them.
Definitions
The canonical token of the cube whose stickers are facelets.
facelets are 6 * n * n face indices in the layout of
Orbit64.Net.toFacelets. The names of the colors do not matter, only
which stickers share one. Each color must occur n * n times.
The canonical token of a decoded state.