예제 #1
0
파일: steptwo.py 프로젝트: sviatpov/cubic
    def rotate(self, cub, mv, col1, col2, col3, face):
        self.mvorig = corners(self.origin.cub, col1, col2, col3)
        self.mvcurent = corners(cub.cub, col1, col2, col3)

        if not self.facolor(cub, face):
            if self.mvcurent[0] == 4:
                self.mvcanny(cub, mv, col1, col2, col3)
            if self.mvcurent[0] == 5:
                self.mvcanny2(cub, mv, col1, col2, col3, face)
        self.mvcurent = corners(cub.cub, col1, col2, col3)
        if self.facolor(cub, face):
            self.mvfaces(cub, mv, col1, col2, col3, face)
예제 #2
0
파일: steptwo.py 프로젝트: sviatpov/cubic
    def mvcanny(self, cub, mv, col1, col2, col3):
        def appendix(list, cub, mv):
            for l in list:
                cub.rotate_by_name(l)
                mv.append(l)

        self.mvcurent = corners(cub.cub, col1, col2, col3)
        if self.mvcurent[3] == 2 and self.mvcurent[6] == 0:
            appendix(["F", "D'", "F'"], cub, mv)
        elif self.mvcurent[3] == 3 and self.mvcurent[6] == 0:
            appendix(["F'", "D", "F"], cub, mv)
        elif self.mvcurent[3] == 2 and self.mvcurent[6] == 1:
            appendix(["B'", "D", "B"], cub, mv)
        elif self.mvcurent[3] == 3 and self.mvcurent[6] == 1:
            appendix(["B", "D'", "B'"], cub, mv)
        self.mvcurent = corners(cub.cub, col1, col2, col3)
예제 #3
0
파일: stepsix.py 프로젝트: sviatpov/cubic
    def getrehtung(self, cub):
        cub.D()
        c = 0
        isrightcorner = []

        self.mvcurent = corners(cub.cub, 5, 0, 2)
        if self.facolor(cub, 0):
            c += 1
        self.mvcurent = corners(cub.cub, 5, 1, 2)
        if self.facolor(cub, 2):
            c += 1
        self.mvcurent = corners(cub.cub, 5, 1, 3)
        if self.facolor(cub, 1):
            c += 1
        self.mvcurent = corners(cub.cub, 5, 0, 3)
        if self.facolor(cub, 3):
            c += 1
        ret = 3
        if c == 0:
            ret = 2
        cub.Ds()
        return ret
예제 #4
0
파일: steptwo.py 프로젝트: sviatpov/cubic
 def mvcanny2(self, cub, mv, col1, col2, col3, face):
     while not self.facolor(cub, face):
         cub.D()
         mv.append("D")
         self.mvcurent = corners(cub.cub, col1, col2, col3)
예제 #5
0
파일: stepsix.py 프로젝트: sviatpov/cubic
    def solver(self, cub, mv):
        c = 0
        if edges_corners_checker(self.origin.cub, cub.cub, 5, 0, 2):
            c += 1
        if edges_corners_checker(self.origin.cub, cub.cub, 5, 1, 3):
            c += 1
        if edges_corners_checker(self.origin.cub, cub.cub, 5, 2, 1):
            c += 1
        if edges_corners_checker(self.origin.cub, cub.cub, 5, 3, 0):
            c += 1
        if c == 4:
            return
        c = 0
        isrightcorner = []

        self.mvcurent = corners(cub.cub, 5, 0, 2)
        if self.facolor(cub, 0):
            c += 1

        self.mvcurent = corners(cub.cub, 5, 1, 2)
        if self.facolor(cub, 2):
            c += 1

        self.mvcurent = corners(cub.cub, 5, 1, 3)
        if self.facolor(cub, 1):
            c += 1

        self.mvcurent = corners(cub.cub, 5, 0, 3)
        if self.facolor(cub, 3):
            c += 1

        if c == 4:
            return
        if c == 0:
            self.appendix(["D", "L", "D'", "R'", "D", "L'", "D'", "R"], cub,
                          mv)

        c = 0
        isrightcorner = []

        self.mvcurent = corners(cub.cub, 5, 0, 2)
        if self.facolor(cub, 0):
            c += 1
            isrightcorner.append(5)
            isrightcorner.append(0)
            isrightcorner.append(2)
        self.mvcurent = corners(cub.cub, 5, 1, 2)
        if self.facolor(cub, 2):
            c += 1
            isrightcorner.append(5)
            isrightcorner.append(1)
            isrightcorner.append(2)
        self.mvcurent = corners(cub.cub, 5, 1, 3)
        if self.facolor(cub, 1):
            c += 1
            isrightcorner.append(5)
            isrightcorner.append(1)
            isrightcorner.append(3)
        self.mvcurent = corners(cub.cub, 5, 0, 3)
        if self.facolor(cub, 3):
            c += 1
            isrightcorner.append(5)
            isrightcorner.append(0)
            isrightcorner.append(3)
        shablon = []
        if isrightcorner == [5, 0, 2]:
            shablon.append(self.getrehtung(cub))
            if shablon[0] == 3:
                shablon.append('f')
            else:
                shablon.append('r')
        elif isrightcorner == [5, 1, 3]:
            shablon.append(self.getrehtung(cub))
            if shablon[0] == 3:
                shablon.append("b")
            else:
                shablon.append('l')
        elif isrightcorner == [5, 1, 2]:
            shablon.append(self.getrehtung(cub))
            if shablon[0] == 3:
                shablon.append('r')
            else:
                shablon.append('b')
        elif isrightcorner == [5, 0, 3]:
            shablon.append(self.getrehtung(cub))
            if shablon[0] == 3:
                shablon.append('l')
            else:
                shablon.append('f')
        if shablon[1] == 'f':
            if shablon[0] == 2:
                self.appendix(["D", "L", "D'", "R'", "D", "L'", "D'", "R"],
                              cub, mv)
            else:
                self.appendix(["D'", "R'", "D", "L", "D'", "R", "D", "L'"],
                              cub, mv)
        elif shablon[1] == 'b':
            if shablon[0] == 2:
                self.appendix(["D", "R", "D'", "L'", "D", "R'", "D'", "L"],
                              cub, mv)
            else:
                self.appendix(["D'", "L'", "D", "R", "D'", "L", "D", "R'"],
                              cub, mv)
        elif shablon[1] == 'r':
            if shablon[0] == 2:
                self.appendix(["D", "F", "D'", "B'", "D", "F'", "D'", "B"],
                              cub, mv)
            else:
                self.appendix(["D'", "B'", "D", "F", "D'", "B", "D", "F'"],
                              cub, mv)
        elif shablon[1] == 'l':
            if shablon[0] == 2:
                self.appendix(["D", "B", "D'", "F'", "D", "B'", "D'", "F"],
                              cub, mv)
            else:
                self.appendix(["D'", "F'", "D", "B", "D'", "F", "D", "B'"],
                              cub, mv)
예제 #6
0
 def rotateside(self, cub, mv, col1, col2, col3):
     while True:
         pos = corners(cub.cub, col1, col2, col3)
         if pos[0] == 5 and pos[-3] == 5:
             break
         self.appendix(["L'", "U'", "L", "U"], cub, mv)