cube_solver.cube.enums module

Enums module.

class cube_solver.cube.enums.IntEnum(value)[source]

Bases: int, Enum

Integer enumeration.

class cube_solver.cube.enums.Axis(value)[source]

Bases: IntEnum

Axis enumeration.

NONE = -1

No axis.

X = 0

X axis along Cubie.R and Cubie.L centers.

Y = 1

Y axis along Cubie.U and Cubie.D centers.

Z = 2

Z axis along Cubie.F and Cubie.B centers.

DIAG_111 = 3

Diagonal axis along Cubie.UFR and Cubie.DBL corners.

DIAG_M11 = 4

Diagonal axis along Cubie.UFL and Cubie.DBR corners.

DIAG_1M1 = 5

Diagonal axis along Cubie.UBL and Cubie.DFR corners.

DIAG_11M = 6

Diagonal axis along Cubie.UBR and Cubie.DFL corners.

EDGE_011 = 7

Edge axis along Cubie.UF and Cubie.DB edges.

EDGE_0M1 = 8

Edge axis along Cubie.UB and Cubie.DF edges.

EDGE_101 = 9

Edge axis along Cubie.FR and Cubie.BL edges.

EDGE_M01 = 10

Edge axis along Cubie.FL and Cubie.BR edges.

EDGE_110 = 11

Edge axis along Cubie.UR and Cubie.DL edges.

EDGE_M10 = 12

Edge axis along Cubie.UL and Cubie.DR edges.

property is_cartesian: bool

Whether this is a cartesian axis.

property is_diagonal: bool

Whether this is a diagonal axis.

property is_edge: bool

Whether this is an edge axis.

classmethod axes()[source]

Iterate over valid axes.

Return type:

Iterator[Axis]

classmethod cartesian_axes()[source]

Iterate over cartesian axes.

Return type:

Iterator[Axis]

classmethod diagonal_axes()[source]

Iterate over diagonal axes.

Return type:

Iterator[Axis]

classmethod edge_axes()[source]

Iterate over edge axes.

Return type:

Iterator[Axis]

class cube_solver.cube.enums.Orbit(value)[source]

Bases: IntEnum

Orbit enumeration.

NONE = -1

No orbit.

SLICE_MIDDLE = 0

Middle slice orbit.

SLICE_EQUATOR = 1

Equator slice orbit.

SLICE_STANDING = 2

Standing slice orbit.

TETRAD_111 = 3

Tetrad orbit containing the Cubie.UBL, Cubie.UFR, Cubie.DBR, and Cubie.DFL corners.

TETRAD_M11 = 4

Tetrad orbit containing the Cubie.UBR, Cubie.UFL, Cubie.DBL, and Cubie.DFR corners.

property is_slice: bool

Whether this is a slice orbit.

property is_tetrad: bool

Whether this is a tetrad orbit.

classmethod orbits()[source]

Iterate over valid orbits.

Return type:

Iterator[Orbit]

classmethod slices()[source]

Iterate over slice orbits.

Return type:

Iterator[Orbit]

classmethod tetrads()[source]

Iterate over tetrad orbits.

Return type:

Iterator[Orbit]

class cube_solver.cube.enums.Layer(value)[source]

Bases: IntEnum

Layer enumeration.

NONE = -1

No layer.

UP = 0

Up layer.

FRONT = 1

Front layer.

RIGHT = 2

Right layer.

DOWN = 3

Down layer.

BACK = 4

Back layer.

LEFT = 5

Left layer.

MIDDLE = 6

Middle layer.

EQUATOR = 7

Equator layer.

STANDING = 8

Standing layer.

property char: str

Character representation of the layer.

property axis: Axis

Layer axis.

property perm: List[List[Cubie]]

Layer permutation.

property is_outer: bool

Whether this is an outer layer.

property is_inner: bool

Whether this is an inner layer.

classmethod from_char(char)[source]

Return the corresponding Layer enum.

Parameters:

char ({'N', 'U', 'F', 'R', 'D', 'B', 'L', 'M', 'E', 'S'}) –

Character representing the layer.

Returns:

layerLayer enum.

Return type:

Layer

classmethod layers()[source]

Iterate over valid layers.

Return type:

Iterator[Layer]

classmethod outers()[source]

Iterate over outer layers.

Return type:

Iterator[Layer]

classmethod inners()[source]

Iterate over inner layers.

Return type:

Iterator[Layer]

class cube_solver.cube.enums.Color(value)[source]

Bases: IntEnum

Color enumeration.

NONE = -1

No color.

WHITE = 0

White color.

GREEN = 1

Green color.

RED = 2

Red color.

YELLOW = 3

Yellow color.

BLUE = 4

Blue color.

ORANGE = 5

Orange color.

property char: str

Character representation of the color.

classmethod from_char(char)[source]

Return the corresponding Color enum.

Parameters:

char ({'N', 'W', 'G', 'R', 'Y', 'B', 'O'}) –

Character representing the color.

Returns:

colorColor enum.

Return type:

Color

classmethod colors()[source]

Iterate over valid colors.

Return type:

Iterator[Color]

class cube_solver.cube.enums.Face(value)[source]

Bases: IntEnum

Face enumeration.

NONE = -1

No face.

UP = 0

Up face.

FRONT = 1

Front face.

RIGHT = 2

Right face.

DOWN = 3

Down face.

BACK = 4

Back face.

LEFT = 5

Left face.

property char: str

Character representation of the face.

property axis: Axis

Face axis.

property opposite: Face

Opposite face.

classmethod from_char(char)[source]

Return the corresponding Face enum.

Parameters:

char ({'N', 'U', 'F', 'R', 'D', 'B', 'L'}) –

Character representing the face.

Returns:

faceFace enum.

Return type:

Face

classmethod faces()[source]

Iterate over valid faces.

Return type:

Iterator[Face]

class cube_solver.cube.enums.Cubie(value)[source]

Bases: IntEnum

Cubie enumeration.

NONE = -1

No cubie.

UBL = 0

Up-Back-Left corner.

UFR = 1

Up-Front-Right corner.

DBR = 2

Down-Back-Right corner.

DFL = 3

Down-Front-Left corner.

UBR = 4

Up-Back-Right corner.

UFL = 5

Up-Front-Left corner.

DBL = 6

Down-Back-Left corner.

DFR = 7

Down-Front-Right corner.

UB = 8

Up-Back edge.

UF = 9

Up-Front edge.

DB = 10

Down-Back edge.

DF = 11

Down-Front edge.

UL = 12

Up-Left edge.

UR = 13

Up-Right edge.

DL = 14

Down-Left edge.

DR = 15

Down-Right edge.

BL = 16

Back-Left edge.

BR = 17

Back-Right edge.

FL = 18

Front-Left edge.

FR = 19

Front-Right edge.

U = 20

Up center.

F = 21

Front center.

R = 22

Right center.

D = 23

Down center.

B = 24

Back center.

L = 25

Left center.

CORE = 26

Core.

property axis: Axis

Cubie axis.

property orbit: Orbit

Cubie orbit.

property faces: List[Face]

Cubie visible faces.

property is_corner: bool

Whether the cubie is a corner.

property is_edge: bool

Whether the cubie is an edge.

property is_center: bool

Whether the cubie is a center.

classmethod from_faces(faces)[source]

Return the corresponding Cubie enum.

Parameters:

faces (list of Face) – Visible faces of the cubie. If faces represent a corner, they must be provided in clockwise order to verify that it’s a valid corner.

Returns:

cubieCubie enum.

Return type:

Cubie

classmethod cubies()[source]

Iterate over valud cubies.

Return type:

Iterator[Cubie]

classmethod corners()[source]

Iterate over corner cubies.

Return type:

Iterator[Cubie]

classmethod edges()[source]

Iterate over edge cubies.

Return type:

Iterator[Cubie]

classmethod centers()[source]

Iterate over center cubies.

Return type:

Iterator[Cubie]

class cube_solver.cube.enums.Move(value)[source]

Bases: IntEnum

Move enumeration.

NONE = -1

No move.

U1 = 0

U face move.

U2 = 1

U2 face move.

U3 = 2

U’ face move.

F1 = 3

F face move.

F2 = 4

F2 face move.

F3 = 5

F’ face move.

R1 = 6

R face move.

R2 = 7

R2 face move.

R3 = 8

R’ face move.

D1 = 9

D face move.

D2 = 10

D2 face move.

D3 = 11

D’ face move.

B1 = 12

B face move.

B2 = 13

B2 face move.

B3 = 14

B’ face move.

L1 = 15

L face move.

L2 = 16

L2 face move.

L3 = 17

L’ face move.

M1 = 18

M slice move.

M2 = 19

M2 slice move.

M3 = 20

M’ slice move.

E1 = 21

E slice move.

E2 = 22

E2 slice move.

E3 = 23

E’ slice move.

S1 = 24

S slice move.

S2 = 25

S2 slice move.

S3 = 26

S’ slice move.

UW1 = 27

Uw or u wide move.

UW2 = 28

Uw2 or u2 wide move.

UW3 = 29

Uw’ or u’ wide move.

FW1 = 30

Fw or f wide move.

FW2 = 31

Fw2 or f2 wide move.

FW3 = 32

Fw’ or f’ wide move.

RW1 = 33

Rw or r wide move.

RW2 = 34

Rw2 or r2 wide move.

RW3 = 35

Rw’ or r’ wide move.

DW1 = 36

Dw or d wide move.

DW2 = 37

Dw2 or d2 wide move.

DW3 = 38

Dw’ or d’ wide move.

BW1 = 39

Bw or b wide move.

BW2 = 40

Bw2 or b2 wide move.

BW3 = 41

Bw’ or b’ wide move.

LW1 = 42

Lw or l wide move.

LW2 = 43

Lw2 or l2 wide move.

LW3 = 44

Lw’ or l’ wide move.

X1 = 45

x rotation.

X2 = 46

x2 rotation.

X3 = 47

x’ rotation.

Y1 = 48

y rotation.

Y2 = 49

y2 rotation.

Y3 = 50

y’ rotation.

Z1 = 51

z rotation.

Z2 = 52

z2 rotation.

Z3 = 53

z’ rotation.

property string: str

String representation of the move.

property axis: Axis

Move axis.

property inverse: Move

Inverse move.

property layers: List[Layer]

Move layers.

property shifts: List[int]

Permutation shift for each layer.

property is_face: bool

Whether this is a face move.

property is_slice: bool

Whether this is a slice move.

property is_wide: bool

Whether this is a wide move.

property is_rotation: bool

Whether the move is a rotation.

classmethod from_string(string)[source]

Return the corresponding Move enum.

Parameters:

string (str) – String representation of the move.

Returns:

moveMove enum.

Return type:

Move

classmethod moves()[source]

Iterate over valid moves.

Return type:

Iterator[Move]

classmethod face_moves()[source]

Iterate over face moves.

Return type:

Iterator[Move]

classmethod slice_moves()[source]

Iterate over slice moves.

Return type:

Iterator[Move]

classmethod wide_moves()[source]

Iterate over wide moves.

Return type:

Iterator[Move]

classmethod rotations()[source]

Iterate over rotations.

Return type:

Iterator[Move]