22import os .path
33import cPickle
44
5- from cubiecube import CubieCube , moveCube , getURtoDF
5+ from . cubiecube import CubieCube , moveCube , getURtoDF
66
77log = logging .getLogger (__name__ )
88
@@ -115,12 +115,12 @@ def move(self, m):
115115 # twist = 0 in phase 2.
116116 twistMove = load_cachetable ('twistMove' )
117117 if not twistMove :
118- twistMove = [[0 ] * N_MOVE for i in xrange (N_TWIST )] # new short[N_TWIST][N_MOVE]
118+ twistMove = [[0 ] * N_MOVE for i in range (N_TWIST )] # new short[N_TWIST][N_MOVE]
119119 a = CubieCube ()
120- for i in xrange (N_TWIST ):
120+ for i in range (N_TWIST ):
121121 a .setTwist (i )
122- for j in xrange (6 ):
123- for k in xrange (3 ):
122+ for j in range (6 ):
123+ for k in range (3 ):
124124 a .cornerMultiply (moveCube [j ])
125125 twistMove [i ][3 * j + k ] = a .getTwist ()
126126 a .cornerMultiply (moveCube [j ]) # 4. faceturn restores
@@ -135,12 +135,12 @@ def move(self, m):
135135
136136 flipMove = load_cachetable ('flipMove' )
137137 if not flipMove :
138- flipMove = [[0 ] * N_MOVE for i in xrange (N_FLIP )] # new short[N_FLIP][N_MOVE]
138+ flipMove = [[0 ] * N_MOVE for i in range (N_FLIP )] # new short[N_FLIP][N_MOVE]
139139 a = CubieCube ()
140- for i in xrange (N_FLIP ):
140+ for i in range (N_FLIP ):
141141 a .setFlip (i )
142- for j in xrange (6 ):
143- for k in xrange (3 ):
142+ for j in range (6 ):
143+ for k in range (3 ):
144144 a .edgeMultiply (moveCube [j ])
145145 flipMove [i ][3 * j + k ] = a .getFlip ()
146146 a .edgeMultiply (moveCube [j ])
@@ -165,12 +165,12 @@ def move(self, m):
165165
166166 FRtoBR_Move = load_cachetable ('FRtoBR_Move' )
167167 if not FRtoBR_Move :
168- FRtoBR_Move = [[0 ] * N_MOVE for i in xrange (N_FRtoBR )] # new short[N_FRtoBR][N_MOVE]
168+ FRtoBR_Move = [[0 ] * N_MOVE for i in range (N_FRtoBR )] # new short[N_FRtoBR][N_MOVE]
169169 a = CubieCube ()
170- for i in xrange (N_FRtoBR ):
170+ for i in range (N_FRtoBR ):
171171 a .setFRtoBR (i )
172- for j in xrange (6 ):
173- for k in xrange (3 ):
172+ for j in range (6 ):
173+ for k in range (3 ):
174174 a .edgeMultiply (moveCube [j ])
175175 FRtoBR_Move [i ][3 * j + k ] = a .getFRtoBR ()
176176 a .edgeMultiply (moveCube [j ])
@@ -186,12 +186,12 @@ def move(self, m):
186186 log .info ('Preparing move table for permutation of six corners. The positions of the DBL and DRB corners are determined by the parity.' )
187187 URFtoDLF_Move = load_cachetable ('URFtoDLF_Move' )
188188 if not URFtoDLF_Move :
189- URFtoDLF_Move = [[0 ] * N_MOVE for i in xrange (N_URFtoDLF )] # new short[N_URFtoDLF][N_MOVE]
189+ URFtoDLF_Move = [[0 ] * N_MOVE for i in range (N_URFtoDLF )] # new short[N_URFtoDLF][N_MOVE]
190190 a = CubieCube ()
191- for i in xrange (N_URFtoDLF ):
191+ for i in range (N_URFtoDLF ):
192192 a .setURFtoDLF (i )
193- for j in xrange (6 ):
194- for k in xrange (3 ):
193+ for j in range (6 ):
194+ for k in range (3 ):
195195 a .cornerMultiply (moveCube [j ])
196196 URFtoDLF_Move [i ][3 * j + k ] = a .getURFtoDLF ()
197197 a .cornerMultiply (moveCube [j ])
@@ -206,12 +206,12 @@ def move(self, m):
206206 log .info ('Preparing move table for the permutation of six U-face and D-face edges in phase2. The positions of the DL and DB edges are' )
207207 URtoDF_Move = load_cachetable ('URtoDF_Move' )
208208 if not URtoDF_Move :
209- URtoDF_Move = [[0 ] * N_MOVE for i in xrange (N_URtoDF )] # new short[N_URtoDF][N_MOVE]
209+ URtoDF_Move = [[0 ] * N_MOVE for i in range (N_URtoDF )] # new short[N_URtoDF][N_MOVE]
210210 a = CubieCube ()
211- for i in xrange (N_URtoDF ):
211+ for i in range (N_URtoDF ):
212212 a .setURtoDF (i )
213- for j in xrange (6 ):
214- for k in xrange (3 ):
213+ for j in range (6 ):
214+ for k in range (3 ):
215215 a .edgeMultiply (moveCube [j ])
216216 URtoDF_Move [i ][3 * j + k ] = a .getURtoDF ()
217217 # Table values are only valid for phase 2 moves!
@@ -225,12 +225,12 @@ def move(self, m):
225225 log .info ('Preparing move table for the three edges UR,UF and UL in phase1.' )
226226 URtoUL_Move = load_cachetable ('URtoUL_Move' )
227227 if not URtoUL_Move :
228- URtoUL_Move = [[0 ] * N_MOVE for i in xrange (N_URtoUL )] # new short[N_URtoUL][N_MOVE]
228+ URtoUL_Move = [[0 ] * N_MOVE for i in range (N_URtoUL )] # new short[N_URtoUL][N_MOVE]
229229 a = CubieCube ()
230- for i in xrange (N_URtoUL ):
230+ for i in range (N_URtoUL ):
231231 a .setURtoUL (i )
232- for j in xrange (6 ):
233- for k in xrange (3 ):
232+ for j in range (6 ):
233+ for k in range (3 ):
234234 a .edgeMultiply (moveCube [j ])
235235 URtoUL_Move [i ][3 * j + k ] = a .getURtoUL ()
236236 a .edgeMultiply (moveCube [j ])
@@ -241,12 +241,12 @@ def move(self, m):
241241 log .info ('Preparing move table for the three edges UB,DR and DF in phase1.' )
242242 UBtoDF_Move = load_cachetable ('UBtoDF_Move' )
243243 if not UBtoDF_Move :
244- UBtoDF_Move = [[0 ] * N_MOVE for i in xrange (N_UBtoDF )] # new short[N_UBtoDF][N_MOVE]
244+ UBtoDF_Move = [[0 ] * N_MOVE for i in range (N_UBtoDF )] # new short[N_UBtoDF][N_MOVE]
245245 a = CubieCube ()
246- for i in xrange (N_UBtoDF ):
246+ for i in range (N_UBtoDF ):
247247 a .setUBtoDF (i )
248- for j in xrange (6 ):
249- for k in xrange (3 ):
248+ for j in range (6 ):
249+ for k in range (3 ):
250250 a .edgeMultiply (moveCube [j ])
251251 UBtoDF_Move [i ][3 * j + k ] = a .getUBtoDF ()
252252 a .edgeMultiply (moveCube [j ])
@@ -257,11 +257,11 @@ def move(self, m):
257257 log .info ('Preparing table to merge the coordinates of the UR,UF,UL and UB,DR,DF edges at the beginning of phase2' )
258258 MergeURtoULandUBtoDF = load_cachetable ('MergeURtoULandUBtoDF' )
259259 if not MergeURtoULandUBtoDF :
260- MergeURtoULandUBtoDF = [[0 ] * 336 for i in xrange (336 )] # new short[336][336]
260+ MergeURtoULandUBtoDF = [[0 ] * 336 for i in range (336 )] # new short[336][336]
261261 # for i, j <336 the six edges UR,UF,UL,UB,DR,DF are not in the
262262 # UD-slice and the index is <20160
263- for uRtoUL in xrange (336 ):
264- for uBtoDF in xrange (336 ):
263+ for uRtoUL in range (336 ):
264+ for uBtoDF in range (336 ):
265265 MergeURtoULandUBtoDF [uRtoUL ][uBtoDF ] = getURtoDF (uRtoUL , uBtoDF )
266266 dump_cachetable (MergeURtoULandUBtoDF , 'MergeURtoULandUBtoDF' )
267267
@@ -278,12 +278,12 @@ def move(self, m):
278278 setPruning (Slice_URFtoDLF_Parity_Prun , 0 , 0 )
279279 done = 1
280280 while (done != N_SLICE2 * N_URFtoDLF * N_PARITY ):
281- for i in xrange (N_SLICE2 * N_URFtoDLF * N_PARITY ):
281+ for i in range (N_SLICE2 * N_URFtoDLF * N_PARITY ):
282282 parity = i % 2
283283 URFtoDLF = (i / 2 ) / N_SLICE2
284284 _slice = (i / 2 ) % N_SLICE2
285285 if getPruning (Slice_URFtoDLF_Parity_Prun , i ) == depth :
286- for j in xrange (18 ):
286+ for j in range (18 ):
287287 if j in (3 , 5 , 6 , 8 , 12 , 14 , 15 , 17 ):
288288 continue
289289 else :
@@ -313,12 +313,12 @@ def move(self, m):
313313 setPruning (Slice_URtoDF_Parity_Prun , 0 , 0 )
314314 done = 1
315315 while (done != N_SLICE2 * N_URtoDF * N_PARITY ):
316- for i in xrange (N_SLICE2 * N_URtoDF * N_PARITY ):
316+ for i in range (N_SLICE2 * N_URtoDF * N_PARITY ):
317317 parity = i % 2
318318 URtoDF = (i / 2 ) / N_SLICE2
319319 _slice = (i / 2 ) % N_SLICE2
320320 if (getPruning (Slice_URtoDF_Parity_Prun , i ) == depth ):
321- for j in xrange (18 ):
321+ for j in range (18 ):
322322 if j in (3 , 5 , 6 , 8 , 12 , 14 , 15 , 17 ):
323323 continue
324324 else :
@@ -347,11 +347,11 @@ def move(self, m):
347347 setPruning (Slice_Twist_Prun , 0 , 0 )
348348 done = 1
349349 while (done != N_SLICE1 * N_TWIST ):
350- for i in xrange (N_SLICE1 * N_TWIST ):
350+ for i in range (N_SLICE1 * N_TWIST ):
351351 twist = i / N_SLICE1
352352 _slice = i % N_SLICE1
353353 if (getPruning (Slice_Twist_Prun , i ) == depth ):
354- for j in xrange (18 ):
354+ for j in range (18 ):
355355 newSlice = FRtoBR_Move [_slice * 24 ][j ] / 24
356356 newTwist = twistMove [twist ][j ]
357357 if (getPruning (Slice_Twist_Prun , N_SLICE1 * newTwist + newSlice ) == 0x0f ):
@@ -373,11 +373,11 @@ def move(self, m):
373373 setPruning (Slice_Flip_Prun , 0 , 0 )
374374 done = 1
375375 while (done != N_SLICE1 * N_FLIP ):
376- for i in xrange (N_SLICE1 * N_FLIP ):
376+ for i in range (N_SLICE1 * N_FLIP ):
377377 flip = i / N_SLICE1
378378 _slice = i % N_SLICE1
379379 if (getPruning (Slice_Flip_Prun , i ) == depth ):
380- for j in xrange (18 ):
380+ for j in range (18 ):
381381 newSlice = FRtoBR_Move [_slice * 24 ][j ] / 24
382382 newFlip = flipMove [flip ][j ]
383383 if (getPruning (Slice_Flip_Prun , N_SLICE1 * newFlip + newSlice ) == 0x0f ):
0 commit comments