def seq_nor(): inst.append(cR.r(1, mat)) # R' inst.append(cR.u(1, mat)) # U' inst.append(cR.r(-1, mat)) # R inst.append(cR.u(1, mat)) # U' inst.append(cR.r(1, mat)) # R' inst.extend(cS.u(2, mat)) # U2 inst.append(cR.r(-1, mat)) # R
def seq_inv(): inst.append(cR.r(1, mat)) # R' inst.extend(cS.u(2, mat)) # U2 inst.append(cR.r(-1, mat)) # R inst.append(cR.u(-1, mat)) # U inst.append(cR.r(1, mat)) # R' inst.append(cR.u(-1, mat)) # U inst.append(cR.r(-1, mat)) # R
def seq(): inst.append(cR.r(-1, mat)) # R inst.append(cR.u(1, mat)) # U' inst.append(cR.l(1, mat)) # L' inst.append(cR.u(-1, mat)) # U inst.append(cR.r(1, mat)) # R' inst.append(cR.u(1, mat)) # U' inst.append(cR.l(-1, mat)) # L
def steps(mat, inst): import cubeSfy as cS import cubeRot as cR for k in range(0, 4): if mat[0][0][0][0] == mat[0][1][0][0]: break cR.u(1, mat) cS.u(k, mat) inst.extend(cS.u(-k, mat))
def u(vec, mat): inst_prt = [] import cubeRot vec = (vec) % 4 if vec < 3: for i in range(0, vec): inst_prt.append(cubeRot.u(-1, mat)) else: inst_prt.append(cubeRot.u(1, mat)) return inst_prt
def seq_main(): for k in range(0, 4): if mat[0][1][0][2] == 0: break cR.u(1, mat) if mat[1][1][0][0] == 0: cS.u(k, mat) inst.extend(cS.u(-k, mat)) seq_nor() elif mat[1][1][0][1] == 0: cS.u(k, mat) inst.extend(cS.u(-k + 2, mat)) seq_inv()
def corFix(conds): while not (set(conds) < set(mat[0][1][1])) and mat[0][1][1][2] != 5: if set(conds) < set(mat[0][1][1]): inst.extend(cR.r(1, mat)) #if mat[0][1][1][2]==5 : #break inst.extend(cR.u(1, mat)) elif set(conds) < set(mat[0][1][0]): if mat[0][1][0][0] == 5: inst.extend(cR.r(-1, mat)) else: inst.extend(cR.u(1, mat)) elif set(conds) < set(mat[1][1][0]): inst.extend(cR.u(1, mat)) elif set(conds) < set(mat[1][1][1]): inst.extend(cR.u(-1, mat)) elif set(conds) < set(mat[0][0][0]): inst.extend(cR.l(-1, mat)) elif set(conds) < set(mat[0][0][1]): inst.extend(cR.l(1, mat)) elif set(conds) < set(mat[1][0][0]): inst.extend(cR.r(1, mat)) inst.extend(cR.u(1, mat)) elif set(conds) < set(mat[1][0][1]): inst.extend(cR.r(-1, mat)) inst.extend(cR.u(-1, mat))
def seq(dirn): inst.extend(cR.u(1, mat)) # U' inst.extend(cR.l(dirn, mat)) # dirn=1 : L' ; dirn=-1 : L inst.extend(cR.u(-1, mat)) # U inst.extend(cR.l(-dirn, mat)) # dirn=-1 : L ; dirn=1 : L'
def steps(mat, inst): import cubeSfy as cS import cubeRot as cR def seq(dirn): inst.extend(cR.u(1, mat)) # U' inst.extend(cR.l(dirn, mat)) # dirn=1 : L' ; dirn=-1 : L inst.extend(cR.u(-1, mat)) # U inst.extend(cR.l(-dirn, mat)) # dirn=-1 : L ; dirn=1 : L' def corFix(conds): while not (set(conds) < set(mat[0][1][1])) and mat[0][1][1][2] != 5: if set(conds) < set(mat[0][1][1]): inst.extend(cR.r(1, mat)) #if mat[0][1][1][2]==5 : #break inst.extend(cR.u(1, mat)) elif set(conds) < set(mat[0][1][0]): if mat[0][1][0][0] == 5: inst.extend(cR.r(-1, mat)) else: inst.extend(cR.u(1, mat)) elif set(conds) < set(mat[1][1][0]): inst.extend(cR.u(1, mat)) elif set(conds) < set(mat[1][1][1]): inst.extend(cR.u(-1, mat)) elif set(conds) < set(mat[0][0][0]): inst.extend(cR.l(-1, mat)) elif set(conds) < set(mat[0][0][1]): inst.extend(cR.l(1, mat)) elif set(conds) < set(mat[1][0][0]): inst.extend(cR.r(1, mat)) inst.extend(cR.u(1, mat)) elif set(conds) < set(mat[1][0][1]): inst.extend(cR.r(-1, mat)) inst.extend(cR.u(-1, mat)) corFix([5]) if 5 in mat[1][0][1] and mat[0][1][1][1] in mat[1][0][1]: inst.extend(cS.r(2, mat)) inst.extend(cR.u(1, mat)) inst.extend(cR.r(1, mat)) corFix([5, mat[1][0][1][2]]) inst.extend(cR.r(-1, mat)) inst.extend(cR.u(1, mat)) inst.extend(cS.r(2, mat)) corFix([5, mat[1][0][0][1]]) inst.extend(cR.u(1, mat)) if 5 in mat[1][1][0]: inst.extend(cR.u(1, mat)) inst.extend(cR.l(-1, mat)) inst.extend(cR.u(-1, mat)) if 5 in [ mat[0][0][0][1], mat[0][1][0][1], mat[0][1][1][1], mat[0][0][1][1] ]: k = 0 while mat[0][0][1][1] != 5: cS.l(1, mat) k = k + 1 cS.l(-k, mat) inst.extend(cS.l(k, mat)) seq(1) elif 5 in [ mat[0][0][0][0][0], mat[0][1][0][2], mat[0][1][1][0], mat[0][0][1][2] ]: k = 0 while mat[0][1][0][2] != 5: cS.l(1, mat) k = k + 1 cS.l(-k, mat) inst.extend(cS.l(k, mat)) seq(-1) else: k = 0 while mat[0][1][1][2] != 5: cS.l(1, mat) k = k + 1 cS.l(-k, mat) inst.extend(cS.l(k, mat)) inst.extend(cR.u(-1, mat)) inst.extend(cS.l(2, mat))