-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathenums.py
157 lines (144 loc) · 3.54 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# #################### 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**R3*|*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 = 0
U2 = 1
U3 = 2
U4 = 3
U5 = 4
U6 = 5
U7 = 6
U8 = 7
U9 = 8
R1 = 9
R2 = 10
R3 = 11
R4 = 12
R5 = 13
R6 = 14
R7 = 15
R8 = 16
R9 = 17
F1 = 18
F2 = 19
F3 = 20
F4 = 21
F5 = 22
F6 = 23
F7 = 24
F8 = 25
F9 = 26
D1 = 27
D2 = 28
D3 = 29
D4 = 30
D5 = 31
D6 = 32
D7 = 33
D8 = 34
D9 = 35
L1 = 36
L2 = 37
L3 = 38
L4 = 39
L5 = 40
L6 = 41
L7 = 42
L8 = 43
L9 = 44
B1 = 45
B2 = 46
B3 = 47
B4 = 48
B5 = 49
B6 = 50
B7 = 51
B8 = 52
B9 = 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 = 0
U2 = 1
U3 = 2
R1 = 3
R2 = 4
R3 = 5
F1 = 6
F2 = 7
F3 = 8
D1 = 9
D2 = 10
D3 = 11
L1 = 12
L2 = 13
L3 = 14
B1 = 15
B2 = 16
B3 = 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