skewbsim 0.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- skewbsim-0.0.0/PKG-INFO +3 -0
- skewbsim-0.0.0/README.md +0 -0
- skewbsim-0.0.0/pyproject.toml +0 -0
- skewbsim-0.0.0/setup.cfg +4 -0
- skewbsim-0.0.0/skewbsim/__init__.py +0 -0
- skewbsim-0.0.0/skewbsim/core.py +239 -0
- skewbsim-0.0.0/skewbsim.egg-info/PKG-INFO +3 -0
- skewbsim-0.0.0/skewbsim.egg-info/SOURCES.txt +8 -0
- skewbsim-0.0.0/skewbsim.egg-info/dependency_links.txt +1 -0
- skewbsim-0.0.0/skewbsim.egg-info/top_level.txt +1 -0
skewbsim-0.0.0/PKG-INFO
ADDED
skewbsim-0.0.0/README.md
ADDED
|
File without changes
|
|
File without changes
|
skewbsim-0.0.0/setup.cfg
ADDED
|
File without changes
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# **Simulate Skewb**
|
|
2
|
+
|
|
3
|
+
##Initializing cube state
|
|
4
|
+
|
|
5
|
+
### Creating Fundamental Storage Variables
|
|
6
|
+
|
|
7
|
+
#Standard Color Storage
|
|
8
|
+
#1 = Green
|
|
9
|
+
#2 = Blue
|
|
10
|
+
#3 = Red
|
|
11
|
+
#4 = Orange
|
|
12
|
+
#5 = White
|
|
13
|
+
#6 = Yellow
|
|
14
|
+
Skewb_state=[] #This will store all the faces of the cubes as multiple lists in this format: [Front,Back,Right,Left,Top,Bottom]
|
|
15
|
+
#################
|
|
16
|
+
Front=[]
|
|
17
|
+
Back=[]
|
|
18
|
+
Right=[]
|
|
19
|
+
Left=[]
|
|
20
|
+
Top=[]
|
|
21
|
+
Bottom=[]
|
|
22
|
+
#These lists represent each face of the skewb.
|
|
23
|
+
|
|
24
|
+
### Initializing skewb in a solved state
|
|
25
|
+
|
|
26
|
+
#Standard Piece Storage: [topLEFTcorner,topRIGHTcorner,bottomRIGHTcorner,bottomLEFTcorner,center]
|
|
27
|
+
#The cube state will be green-front, white-top as the WCA Standards and will have the standard BOGR color scheme.
|
|
28
|
+
Front=[1,1,1,1,1]
|
|
29
|
+
Back=[2,2,2,2,2]
|
|
30
|
+
Right=[3,3,3,3,3]
|
|
31
|
+
Left=[4,4,4,4,4]
|
|
32
|
+
Top=[5,5,5,5,5]
|
|
33
|
+
Bottom=[6,6,6,6,6]
|
|
34
|
+
#The list of colors of each pieces has been put in the solved state.
|
|
35
|
+
|
|
36
|
+
Skewb_state=[Front,Back,Right,Left,Top,Bottom]
|
|
37
|
+
#Now, the variable storing the overall state of the cube has been inputted and has been put in solved state (Green Front, White Top)
|
|
38
|
+
|
|
39
|
+
## Creating Turning Mechanisms
|
|
40
|
+
|
|
41
|
+
### Creating turning variables
|
|
42
|
+
|
|
43
|
+
#These variables will store the new state of the cube before updating it
|
|
44
|
+
front_prime=[]
|
|
45
|
+
back_prime=[]
|
|
46
|
+
right_prime=[]
|
|
47
|
+
left_prime=[]
|
|
48
|
+
top_prime=[]
|
|
49
|
+
bottom_prime=[]
|
|
50
|
+
repeat=0 #This variable will be store how many times a turn should be done
|
|
51
|
+
#Repeat=1 Normal Turn
|
|
52
|
+
#Repeat=2 Prime Turn
|
|
53
|
+
|
|
54
|
+
###Defining basic update functions
|
|
55
|
+
|
|
56
|
+
def update_state():
|
|
57
|
+
global front_prime, back_prime, right_prime,left_prime,top_prime,bottom_prime, Front,Back,Right,Left,Top,Bottom,Skewb_state
|
|
58
|
+
#This function will be used to update the state in the end of every turn
|
|
59
|
+
Front = front_prime[:]
|
|
60
|
+
Back = back_prime[:]
|
|
61
|
+
Right = right_prime[:]
|
|
62
|
+
Left = left_prime[:]
|
|
63
|
+
Top = top_prime[:]
|
|
64
|
+
Bottom = bottom_prime[:]
|
|
65
|
+
Skewb_state=[Front,Back,Right,Left,Top,Bottom]
|
|
66
|
+
def clear_turn_var():
|
|
67
|
+
global front_prime, back_prime, right_prime,left_prime,top_prime,bottom_prime, Front,Back,Right,Left,Top,Bottom,Skewb_state
|
|
68
|
+
#The variables storing the new state of the cube will be cleared before starting any turn
|
|
69
|
+
front_prime=[]
|
|
70
|
+
back_prime=[]
|
|
71
|
+
right_prime=[]
|
|
72
|
+
left_prime=[]
|
|
73
|
+
top_prime=[]
|
|
74
|
+
bottom_prime=[]
|
|
75
|
+
import copy
|
|
76
|
+
def load_state():
|
|
77
|
+
global Front, Back, Right, Left, Top, Bottom, Skewb_state
|
|
78
|
+
Front=Skewb_state[0]
|
|
79
|
+
Back=Skewb_state[1]
|
|
80
|
+
Right=Skewb_state[2]
|
|
81
|
+
Left=Skewb_state[3]
|
|
82
|
+
Top=Skewb_state[4]
|
|
83
|
+
Bottom=Skewb_state[5]
|
|
84
|
+
|
|
85
|
+
### Defining turning functions
|
|
86
|
+
|
|
87
|
+
#### R & R' Turns
|
|
88
|
+
|
|
89
|
+
# Like WCA scrambling notation, turning in skewb will be stored as R, U, L & B moves with prime moves possible
|
|
90
|
+
#Actual turning functions will be defined now
|
|
91
|
+
def R_turn(Prime=False):
|
|
92
|
+
|
|
93
|
+
global front_prime, back_prime, right_prime,left_prime,top_prime,bottom_prime, Front,Back,Right,Left,Top,Bottom,Skewb_state
|
|
94
|
+
#Globalizing all of these variables allows them to be updated across the code using this function
|
|
95
|
+
####
|
|
96
|
+
#This is a function that can be used further in the code to perform a R move on a skewb
|
|
97
|
+
#Prime will be a true/false bolean variable that will tell the function whether the move should be R or R'
|
|
98
|
+
####
|
|
99
|
+
clear_turn_var()
|
|
100
|
+
#This resets the required variables
|
|
101
|
+
if Prime:
|
|
102
|
+
repeat=2
|
|
103
|
+
#If a prime move is requested, a R move will be done twice
|
|
104
|
+
else:
|
|
105
|
+
repeat=1
|
|
106
|
+
#If a prime move is not requested, a R move will only be done once
|
|
107
|
+
a=0
|
|
108
|
+
while a < repeat:
|
|
109
|
+
#This will do the R move 'repeat' number of times
|
|
110
|
+
front_prime=[Front[0],Front[1],Left[3],Front[3],Front[4]]
|
|
111
|
+
#Front face variable has been changed
|
|
112
|
+
back_prime=[Right[3],Back[1],Right[1],Right[2],Right[4]]
|
|
113
|
+
#Back face variable has been changed
|
|
114
|
+
right_prime=[Right[0],Bottom[1],Bottom[2],Bottom[3],Bottom[4]]
|
|
115
|
+
#Right face variable has been changed
|
|
116
|
+
left_prime=[Left[0],Left[1],Left[2],Top[1],Left[4]]
|
|
117
|
+
#Left face variable has been changed
|
|
118
|
+
top_prime=[Top[0],Front[2],Top[2],Top[3],Top[4]]
|
|
119
|
+
#Top face variable has been changed
|
|
120
|
+
bottom_prime=[Bottom[0],Back[2],Back[3],Back[0],Back[4]]
|
|
121
|
+
#Bottom face variable has been changed
|
|
122
|
+
update_state()
|
|
123
|
+
#The cube has been updated
|
|
124
|
+
#MOVE DONE
|
|
125
|
+
a+=1
|
|
126
|
+
|
|
127
|
+
#### L & L' Turns
|
|
128
|
+
|
|
129
|
+
def L_turn(Prime=False):
|
|
130
|
+
|
|
131
|
+
global front_prime, back_prime, right_prime,left_prime,top_prime,bottom_prime, Front,Back,Right,Left,Top,Bottom,Skewb_state
|
|
132
|
+
#Globalizing all of these variables allows them to be updated across the code using this function
|
|
133
|
+
####
|
|
134
|
+
#This is a function that can be used further in the code to perform a L move on a skewb
|
|
135
|
+
#Prime will be a true/false bolean variable that will tell the function whether the move should be L or L'
|
|
136
|
+
####
|
|
137
|
+
clear_turn_var()
|
|
138
|
+
#This resets the required variables
|
|
139
|
+
if Prime:
|
|
140
|
+
repeat=2
|
|
141
|
+
#If a prime move is requested, a L move will be done twice
|
|
142
|
+
else:
|
|
143
|
+
repeat=1
|
|
144
|
+
#If a prime move is not requested, a L move will only be done once
|
|
145
|
+
a=0
|
|
146
|
+
while a < repeat:
|
|
147
|
+
#This will do the L move 'repeat' number of times
|
|
148
|
+
front_prime=[Left[3],Front[1],Left[1],Left[2],Left[4]]
|
|
149
|
+
#Front face variable has been changed
|
|
150
|
+
back_prime=[Back[0],Back[1],Right[3],Back[3],Back[4]]
|
|
151
|
+
#Back face variable has been changed
|
|
152
|
+
right_prime=[Right[0],Right[1],Right[2],Top[3],Right[4]]
|
|
153
|
+
#Right face variable has been changed
|
|
154
|
+
left_prime=[Left[0],Bottom[3],Bottom[0],Bottom[1],Bottom[4]]
|
|
155
|
+
#Left face variable has been changed
|
|
156
|
+
top_prime=[Top[0],Top[1],Top[2],Back[2],Top[4]]
|
|
157
|
+
#Top face variable has been changed
|
|
158
|
+
bottom_prime=[Front[3],Front[0],Bottom[2],Front[2],Front[4]]
|
|
159
|
+
#Bottom face variable has been changed
|
|
160
|
+
update_state()
|
|
161
|
+
#The cube has been updated
|
|
162
|
+
#MOVE DONE
|
|
163
|
+
a+=1
|
|
164
|
+
|
|
165
|
+
#### U & U' Turns
|
|
166
|
+
|
|
167
|
+
def U_turn(Prime=False):
|
|
168
|
+
|
|
169
|
+
global front_prime, back_prime, right_prime,left_prime,top_prime,bottom_prime, Front,Back,Right,Left,Top,Bottom,Skewb_state
|
|
170
|
+
#Globalizing all of these variables allows them to be updated across the code using this function
|
|
171
|
+
####
|
|
172
|
+
#This is a function that can be used further in the code to perform a U move on a skewb
|
|
173
|
+
#Prime will be a true/false bolean variable that will tell the function whether the move should be U or U'
|
|
174
|
+
####
|
|
175
|
+
clear_turn_var()
|
|
176
|
+
#This resets the required variables
|
|
177
|
+
if Prime:
|
|
178
|
+
repeat=2
|
|
179
|
+
#If a prime move is requested, a U move will be done twice
|
|
180
|
+
else:
|
|
181
|
+
repeat=1
|
|
182
|
+
#If a prime move is not requested, a U move will only be done once
|
|
183
|
+
a=0
|
|
184
|
+
while a < repeat:
|
|
185
|
+
#This will do the L move 'repeat' number of times
|
|
186
|
+
front_prime=[Right[1],Front[1],Front[2],Front[3],Front[4]]
|
|
187
|
+
#Front face variable has been changed
|
|
188
|
+
back_prime=[Left[3],Left[0],Left[1],Back[3],Left[4]]
|
|
189
|
+
#Back face variable has been changed
|
|
190
|
+
right_prime=[Right[0],Bottom[3],Right[2],Right[3],Right[4]]
|
|
191
|
+
#Right face variable has been changed
|
|
192
|
+
left_prime=[Top[0],Top[1],Left[2],Top[3],Top[4]]
|
|
193
|
+
#Left face variable has been changed
|
|
194
|
+
top_prime=[Back[1],Back[2],Top[2],Back[0],Back[4]]
|
|
195
|
+
#Top face variable has been changed
|
|
196
|
+
bottom_prime=[Bottom[0],Bottom[1],Bottom[2],Front[0],Bottom[4]]
|
|
197
|
+
#Bottom face variable has been changed
|
|
198
|
+
update_state()
|
|
199
|
+
#The cube has been updated
|
|
200
|
+
#MOVE DONE
|
|
201
|
+
a+=1
|
|
202
|
+
|
|
203
|
+
#### B & B' Turns
|
|
204
|
+
|
|
205
|
+
def B_turn(Prime=False):
|
|
206
|
+
|
|
207
|
+
global front_prime, back_prime, right_prime,left_prime,top_prime,bottom_prime, Front,Back,Right,Left,Top,Bottom,Skewb_state
|
|
208
|
+
#Globalizing all of these variables allows them to be updated across the code using this function
|
|
209
|
+
####
|
|
210
|
+
#This is a function that can be used further in the code to perform a B move on a skewb
|
|
211
|
+
#Prime will be a true/false bolean variable that will tell the function whether the move should be B or B'
|
|
212
|
+
####
|
|
213
|
+
clear_turn_var()
|
|
214
|
+
#This resets the required variables
|
|
215
|
+
if Prime:
|
|
216
|
+
repeat=2
|
|
217
|
+
#If a prime move is requested, a B move will be done twice
|
|
218
|
+
else:
|
|
219
|
+
repeat=1
|
|
220
|
+
#If a prime move is not requested, a B move will only be done once
|
|
221
|
+
a=0
|
|
222
|
+
while a < repeat:
|
|
223
|
+
#This will do the L move 'repeat' number of times
|
|
224
|
+
front_prime=[Front[0],Front[1],Front[2],Top[0],Front[4]]
|
|
225
|
+
#Front face variable has been changed
|
|
226
|
+
back_prime=[Back[0],Bottom[2],Bottom[3],Bottom[0],Bottom[4]]
|
|
227
|
+
#Back face variable has been changed
|
|
228
|
+
right_prime=[Right[0],Right[1],Front[3],Right[3],Right[4]]
|
|
229
|
+
#Right face variable has been changed
|
|
230
|
+
left_prime=[Back[3],Left[1],Back[1],Back[2],Back[4]]
|
|
231
|
+
#Left face variable has been changed
|
|
232
|
+
top_prime=[Right[2],Top[1],Top[2],Top[3],Top[4]]
|
|
233
|
+
#Top face variable has been changed
|
|
234
|
+
bottom_prime=[Left[0],Bottom[1],Left[2],Left[3],Left[4]]
|
|
235
|
+
#Bottom face variable has been changed
|
|
236
|
+
update_state()
|
|
237
|
+
#The cube has been updated
|
|
238
|
+
#MOVE DONE
|
|
239
|
+
a+=1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
skewbsim
|