flix

0.75.3

Orbit64.Orbit

enum Orbit with Eq, Order, ToStringSource
case Cornerscase Midgescase Wingscase Centers

The four kinds of orbit.

Fixed centers -- the single stickers at the middle of each face on an odd cube -- are deliberately absent. They never move relative to one another, so they define the reference frame rather than carrying any information of their own.

Instances

instance Eq[Orbit]Source
instance Order[Orbit]Source
instance ToString[Orbit]Source

Definitions

def layout(n: Int32): List[Orbit]§ Source

The orbits of an n x n x n cube, in the order the codec packs them.

The counts are pure arithmetic in n: a cube has (n-2)/2 wing orbits and (n-2)^2/4 center orbits, both truncating. Midges exist only when n is odd. So layout needs no geometry -- which is why this module carries no notion of a face, an axis, or a turn.

Nothing below the 2x2x2 has an orbit. A 1x1x1 is one cubie with nothing to permute, and there is no such thing as a 0x0x0. Without that floor the arithmetic keeps going and answers anyway: (0-2)^2/4 is 1, so a 0x0x0 came back with a center orbit, and a 1x1x1 came back with corners -- which gave it the same state count as a 2x2x2 and therefore the same token width, breaking the one property the format leans on, that a token's length says which puzzle it is.

def radix(o: Orbit): BigInt§ Source

The number of distinct states of a single orbit of kind o.

Each is the exact size of the corresponding coordinate's range, so the mixed-radix product over layout(n) is the state count of the puzzle with nothing wasted.

def size(o: Orbit): Int32§ Source

The number of slots in an orbit of kind o.