-
Notifications
You must be signed in to change notification settings - Fork 0
/
enums.py
97 lines (84 loc) · 3.16 KB
/
enums.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# #################### Enumerations which improve the readability of the code ########################################
from enum import IntEnum
class Facelet(IntEnum):
"""""
The names of the facelet positions of the cube
|************|
|*U1**U2**U3*|
|************|
|*U4**U5**U6*|
|************|
|*U7**U8**U9*|
|************|
|************|************|************|************|
|*L1**L2**L3*|*F1**F2**F3*|*R1**R2**F3*|*B1**B2**B3*|
|************|************|************|************|
|*L4**L5**L6*|*F4**F5**F6*|*R4**R5**R6*|*B4**B5**B6*|
|************|************|************|************|
|*L7**L8**L9*|*F7**F8**F9*|*R7**R8**R9*|*B7**B8**B9*|
|************|************|************|************|
|************|
|*D1**D2**D3*|
|************|
|*D4**D5**D6*|
|************|
|*D7**D8**D9*|
|************|
A cube definition string "UBL..." means for example: In position U1 we have the U-color, in position U2 we have the
B-color, in position U3 we have the L color etc. according to the order U1, U2, U3, U4, U5, U6, U7, U8, U9, R1, R2,
R3, R4, R5, R6, R7, R8, R9, F1, F2, F3, F4, F5, F6, F7, F8, F9, D1, D2, D3, D4, D5, D6, D7, D8, D9, L1, L2, L3, L4,
L5, L6, L7, L8, L9, B1, B2, B3, B4, B5, B6, B7, B8, B9 of the enum constants.
"""
U1, U2, U3, U4, U5, U6, U7, U8, U9 = 0, 1, 2, 3, 4, 5, 6, 7, 8
R1, R2, R3, R4, R5, R6, R7, R8, R9 = 9, 10, 11, 12, 13, 14, 15, 16, 17
F1, F2, F3, F4, F5, F6, F7, F8, F9 = 18, 19, 20, 21, 22, 23, 24, 25, 26
D1, D2, D3, D4, D5, D6, D7, D8, D9 = 27, 28, 29, 30, 31, 32, 33, 34, 35
L1, L2, L3, L4, L5, L6, L7, L8, L9 = 36, 37, 38, 39, 40, 41, 42, 43, 44
B1, B2, B3, B4, B5, B6, B7, B8, B9 = 45, 46, 47, 48, 49, 50, 51, 52, 53
class Color(IntEnum):
""" The possible colors of the cube facelets. Color U refers to the color of the U(p)-face etc.
Also used to name the faces itself."""
U = 0
R = 1
F = 2
D = 3
L = 4
B = 5
class Corner(IntEnum):
"""The names of the corner positions of the cube. Corner URF e.g. has an U(p), a R(ight) and a F(ront) facelet."""
URF = 0
UFL = 1
ULB = 2
UBR = 3
DFR = 4
DLF = 5
DBL = 6
DRB = 7
class Edge(IntEnum):
"""The names of the edge positions of the cube. Edge UR e.g. has an U(p) and R(ight) facelet."""
UR = 0
UF = 1
UL = 2
UB = 3
DR = 4
DF = 5
DL = 6
DB = 7
FR = 8
FL = 9
BL = 10
BR = 11
class Move(IntEnum):
"""The moves in the faceturn metric. Not to be confused with the names of the facelet positions in class Facelet."""
U1, U2, U3 = 0, 1, 2
R1, R2, R3 = 3, 4, 5
F1, F2, F3 = 6, 7, 8
D1, D2, D3 = 9, 10, 11
L1, L2, L3 = 12, 13, 14
B1, B2, B3 = 15, 16, 17
class BS(IntEnum):
"""Basic symmetries of the cube. All 48 cube symmetries can be generated by sequences of these 4 symmetries."""
ROT_URF3 = 0
ROT_F2 = 1
ROT_U4 = 2
MIRR_LR2 = 3