Beispiel #1
0
Datei: qbr.py Projekt: muts/qbr
    def run(self):
        state         = webcam.scan()
        if not state:
            print('\033[0;33m[QBR SCAN ERROR] Ops, you did not scan in all 6 sides.')
            print('Please try again.\033[0m')
            Die(1)

        unsolvedState = combine.sides(state)
        try:
            algorithm     = kociemba.solve(unsolvedState)
            length        = len(algorithm.split(' '))
        except Exception as err:
            print('\033[0;33m[QBR SOLVE ERROR] Ops, you did not scan in all 6 sides correctly.')
            print('Please try again.\033[0m')
            Die(1)

        print('-- SOLUTION --')
        print('Starting position:\n    front: green\n    top: white\n')
        print(algorithm, '({0} moves)'.format(length), '\n')

        if self.humanize:
            manual = normalize.algorithm(algorithm, self.language)
            for index, text in enumerate(manual):
                print('{}. {}'.format(index+1, text))
        Die(0)
Beispiel #2
0
 def run(self):
     state = webcam.scan()
     if not state:
         print(
             '\033[0;33m[QBR SCAN ERROR] you did not scan in all 6 sides.')
         print('Please try again.\033[0m')
         Die(1)
Beispiel #3
0
    def run(self):
        state = webcam.scan()
        if not state:
            print(
                '\033[0;33m[QBR SCAN ERROR] Ops, bbyou did not scan in all 6 sides.'
            )
            print('Please try again.\033[0m')
            Die(1)

        print(state)
        unsolvedState = combine.sides(state)
        print(unsolvedState)
        #try:
        algorithm = kociemba.solve(unsolvedState)

        length = len(algorithm.split(' '))
        #except Exception as err:
        #print('\033[0;33m[QBR SOLVE ERROR] Ops, you did not scan in all 6 sides correctly.')
        #print('Please try again.\033[0m')
        #Die(1)

        print('-- SOLUTION --')
        print('Starting position:\n    front: green\n    top: white\n')
        print(algorithm, '({0} moves)'.format(length), '\n')

        if self.humanize:
            manual = normalize.algorithm(algorithm, self.language)
            for index, text in enumerate(manual):
                print('{}. {}'.format(index + 1, text))
        Die(0)
Beispiel #4
0
def run():
    notation = {
        'blue': 'F',
        'white': 'U',
        'green': 'B',
        'orange': 'R',
        'red': 'L',
        'yellow': 'D'
    }

    state = webcam.scan(notation)
    if not state:
        print(
            '\033[0;33m[QBR SCAN ERROR] Ops, you did not scan in all 6 sides.')
        print('Please try again.\033[0m')
        Die(1)

    from results import results
    RubiksBlindfolded.setCube(state)
    print(RubiksBlindfolded.displayCube())

    try:
        edge = RubiksBlindfolded.solveEdges()
        edgeIndex = RubiksBlindfolded.indexEdgeSequence()
        edgeBuffer = RubiksBlindfolded.currentEdgeBuffer()

        parity = RubiksBlindfolded.parityCheck()
        RubiksBlindfolded.parityAlgorithm()

        corner = RubiksBlindfolded.solveCorners()
        cornerIndex = RubiksBlindfolded.indexCornerSequence()
        cornerBuffer = RubiksBlindfolded.currentCornerBuffer()

    except Exception as err:
        print(
            '\033[0;33m[QBR SOLVE ERROR] Ops, you did not scan in all 6 sides correctly.'
        )
        print('Please try again.\033[0m')
        Die(1)

    print('-- SOLUTION --')
    print('Starting position:\n    front: blue\n    top: white\n')
    print('edge sequence:')
    print(edge)
    print('parity check {}'.format(parity))
    print('corner sequence:')
    print(corner)

    results.visualization(edgeIndex, cornerIndex, edgeBuffer, cornerBuffer,
                          parity, notation)

    Die(0)
    def run(self):
        state = webcam.scan()
        if not state:
            print(
                '\033[0;33m[QBR SCAN ERROR] Ops, you did not scan in all 6 sides.'
            )
            print('Please try again.\033[0m')
            Die(1)

        unsolvedState = combine.sides(state)
        print(unsolvedState)

        Die(0)
Beispiel #6
0
Datei: qbr.py Projekt: Heydok/qbr
    def run(self):
        print('SCANNING GUIDE')
        print(
            '- Make sure to start by scanning by having the green-centered side facing the camera and having the white-centered side on top.'
        )
        print(
            '- Start by scanning the green, red, blue and orange sides. The order in which these colors are scanned does not matter.'
        )
        print('')
        print(
            'Now, make sure to rotate the cube back to where the green-centered side is again facing the camera.'
        )
        print('')
        print(
            '- Turn the cube down and scan the white-centered side (green on bottom, white facing the camera)'
        )
        print(
            '- Turn the cube 180 degrees back and scan the last yellow-centered side (green on top, yellow facing the camera)'
        )
        print('')

        state = webcam.scan()
        if not state:
            print(
                '\033[0;33m[QBR SCAN ERROR] Ops, you did not scan in all 6 sides correctly'
            )
            print('Please try again.\033[0m')
            sys.exit(1)

        try:
            algorithm = kociemba.solve(state)
            length = len(algorithm.split(' '))
        except Exception as err:
            print(
                '\033[0;33m[QBR SCAN ERROR] Ops, you did not scan in all 6 sides correctly'
            )
            print('Please try again.\033[0m')
            sys.exit(1)

        print('Starting position:\nfront: green\ntop: white\n')
        print('Moves: {}'.format(length))
        print('Solution: {}'.format(algorithm))

        if self.humanize:
            manual = normalize.algorithm(algorithm, self.language)
            for index, text in enumerate(manual):
                print('{}. {}'.format(index + 1, text))