3 releases
0.1.2 | Dec 26, 2020 |
---|---|
0.1.1 | Dec 26, 2020 |
0.1.0 | Dec 25, 2020 |
#1493 in Encoding
16KB
268 lines
Natural slice encoding
Encoding some properties of small slices of data as natural numbers.
These are the most compact representations of specific pieces of information about slices.
One use for this library is in encoding the state of a Rubiks Cube in a space efficient way to allow for fast Rubiks cube solving with move tables.
Credit goes to Herbert Kociemba for all the algorithms implemented here and the idea to use them for fast Rubik's cube manipulation.
Permutation
Encode the permutation of elements of a slice as an integer between 0
and n! - 1
where n
is the number of elements in the slice.
See "corner permutation coordinate" and "edge permutation coordinate" here for a description of this encoding in the context of a Rubik's Cube.
Property
Encode a property of elements of a slice which maps to a digit per element in a certain base as an integer between 0
and base^(n - 1) - 1
where n
is the number of elements in the slice.
See "corner orientation coordinate" and "edge orientation coordinate" here for a description of this encoding in the context of a Rubik's Cube.
Position
Encode the position of "interesting" elements in a slice relative to other elements in the same slice. The relative order of "interesting" and "uninteresting" elements is ignored.
See "UD Slice coordinate" here for a description of this encoding in the context of a Rubik's Cube.
Dependencies
~760KB
~14K SLoC