Ejemplo n.º 1
0
def solveoll(col):
    pre = ""
    flag = 0
    t = time.time()
    for x in range(4):
        tcol = [y[:] for y in col]
        if x == 0:
            pre = ""
        if x == 1:
            pre = "U"
            moves.breakscram("U", col)
        if x == 2:
            pre = "U2"
            moves.breakscram("U", col)
        if x == 3:
            pre = "U'"
            moves.breakscram("U", col)
        for i in algs:
            tcol = [y[:] for y in col]
            moves.breakscram(i, tcol)
            if (tcol[0][6] == "yellow" and tcol[0][7] == "yellow"
                    and tcol[0][8] == "yellow" and tcol[1][6] == "yellow"
                    and tcol[1][7] == "yellow" and tcol[1][8] == "yellow"
                    and tcol[2][6] == "yellow" and tcol[2][7] == "yellow"
                    and tcol[2][8] == "yellow"):
                fulloll = pre + " " + i
                moves.breakscram(i, col)
                #print(fulloll)
                flag = 1
                break
        if flag == 1:
            break
    #print(time.time()-t)
    return fulloll
Ejemplo n.º 2
0
def dof2l(col):
    t = time.time()
    max = 0
    fsol = ""
    while (max < 100):
        max = 0
        maxi = ""
        for i in crawl.crawl:
            tcol = [x[:] for x in col]
            moves.breakscram(i, tcol)
            hap = happiness(tcol, i)
            #if i==" R' U R":
            #    print("------", hap)
            if hap >= max:
                max = hap
                maxi = i
        # print(maxi, max)
        fsol = fsol + maxi
        moves.breakscram(maxi, col)

        u = time.time()
        if (u - t > 2):
            return False
    u = time.time()
    #print(u-t)
    return fsol
Ejemplo n.º 3
0
def on_submit(button, user_data):
    if (cube.chk_scan.get_state == True):
        cube.txt_scramble.set_edit_text("")
        # code for scanning goes here
    else:
        moves.breakscram(cube.thescramble, cube.cubearray)
        logs.write(str(cube.cubearray))
        cube.get_side_from_array(cube.cubearray)
        cube.update_cube()
        cube.footer1.set_text(["Finding Solution for : ", ("R", cube.thescramble)])
        #logicthread.start()
        ml.draw_screen()
        do_logic()# sets solution
Ejemplo n.º 4
0
def makecross(col):
    t=time.time()
    max=0
    csol=""
    while(max<100):
        max=0
        maxi = ""
        for i in crawl.crawl:
            tcol=[x[:] for x in col]
            moves.breakscram(i,tcol)
            hap=happiness(tcol, i)
            if hap>= max:
                max=hap
                maxi=i
        csol=csol+ maxi
        print(maxi)
        moves.breakscram(maxi, col)
    u=time.time()
    #print(u-t)
    return csol
Ejemplo n.º 5
0
        if j > 5 and j < 9 and i < 3:
            col[i][j] = "yellow"
        if i > 2 and i < 6:
            if j < 3:
                col[i][j] = "blue"
            if j > 2 and j < 6:
                col[i][j] = "red"
            if j > 5 and j < 9:
                col[i][j] = "green"
            if j > 8 and j < 12:
                col[i][j] = "orange"
        if j > 5 and j < 9 and i > 5:
            col[i][j] = "white"

scramble = input("enter scramble")
moves.breakscram(scramble, col)
logs.write(str(col))

t = time.time()
cr = cross.makecross(col)
f2 = f2l.dof2l(col)
ol = oll.solveoll(col)
pl = pll.solvepll(col)

print("cross", cr)
print("f2l", f2)
print("oll", ol)
print("pll", pl)
fullsol = cr + " " + f2 + " " + ol + " " + pl

print("------------------")
Ejemplo n.º 6
0
def solvepll(col):
    pre = ""
    post = ""
    flag = 0
    t = time.time()
    for x in range(4):
        tcol = [x[:] for x in col]
        if x == 0:
            pre = ""
        if x == 1:
            pre = "U"
            moves.breakscram("U", col)
        if x == 2:
            pre = "U2"
            moves.breakscram("U", col)
        if x == 3:
            pre = "U'"
            moves.breakscram("U", col)
        for i in algs:
            tcol = [x[:] for x in col]
            moves.breakscram(i, tcol)
            if (tcol[3][0] == tcol[3][1] == tcol[3][2]
                    and tcol[3][3] == tcol[3][4] == tcol[3][5]
                    and tcol[3][6] == tcol[3][7] == tcol[3][8]
                    and tcol[3][9] == tcol[3][10] == tcol[3][11]):
                for q in range(4):
                    if q == 0:
                        post = ""
                    if q == 1:
                        post = "U"
                        moves.breakscram("U", tcol)
                    if q == 2:
                        post = "U2"
                        moves.breakscram("U", tcol)
                    if q == 3:
                        post = "U'"
                        moves.breakscram("U", tcol)
                    if tcol[3][0] == "blue":
                        break
                fullpll = pre + " " + i + " " + post
                moves.breakscram(i + " " + post, col)
                #print(fullpll)
                flag = 1
                break
        if flag == 1:
            break
    #print(time.time()-t)
    return fullpll