Ejemplo n.º 1
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)
        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)
Ejemplo n.º 2
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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
    def run(self):
        state         = webcam.scan()
        if not state:
            print('\033[0;33m[QBR SCAN ERROR] Op1s, you did not scan in all 6 sides.')
            print('Please try again.\033[0m')
            Die(1)

        unsolvedState = combine.sides(state)
        
        try:
            a = sv.solve(unsolvedState)
            x = list(a.split(" "))
            print (x)
            del x[-1]
            return x
        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)

        Die(0)
Ejemplo n.º 6
0
main class
*/
from sys import exit as Die
try:
    import solver as sv
    import video as webcam
    from combiner import combine
except ImportError as err:
    Die(err)


class Qbr:

    def __init__(self):
        pass

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

        unsolvedState = combine.sides(state)
        
        try:
            a = sv.solve(unsolvedState)
            x = list(a.split(" "))
            print (x)
            del x[-1]
            return x
        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)

        Die(0)

if __name__ == '__main__':
    a = Qbr().run()
from sys import exit as Die
try:
    import sys
    import argparse
    from video import webcam
    from combiner import combine
except ImportError as err:
    Die(err)


class 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)
        print(unsolvedState)

        Die(0)


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    args = parser.parse_args()
    Qbr().run()