Ejemplo n.º 1
0
def make_shuffled_cube():
    cube = Cube.solved_cube()

    for i in range(30):
        random_face = random.choice(FaceType.FACES)
        random_direction = random.choice(RotationType.ROTATION_DIRECTION)
        perform_face_turn(cube, (random_face, random_direction))

    return cube
Ejemplo n.º 2
0
                         0,'1!','1!',
                         0,'1!','1!'],
        FaceType.UP:   ['4!','4!','4!',
                        '4!','4!','4!',
                        '4!','4!','4!'],
        })

ll_except_side_pattern = solver.CubePattern({
        FaceType.DOWN: ['2!','2!','2!',
                        '2!','2!','2!',
                        '2!','2!','2!'],
        FaceType.RIGHT: ['6!','6!','6!',
                         '6!','6!','6!',
                         '6!', 0,  '6!'],
        FaceType.FRONT: ['3!','3!', 0,
                         '3!','3!', 0,
                         '3!','3!', 0],
        FaceType.LEFT: ['5!', 0,  '5!',
                        '5!','5!','5!',
                        '5!','5!','5!'],
        FaceType.BACK: ['1!','1!','1!',
                         0,  '1!','1!',
                        '1!','1!','1!'],
        FaceType.UP:   ['4!','4!','4!',
                        '4!','4!','4!',
                        '4!','4!','4!'],
        })

done_pattern = solver.CubePattern.from_cube(Cube.solved_cube())

Ejemplo n.º 3
0
from rubiks.solver.fridrich import *
from rubiks.solver.simplest import *
from rubiks.solver import base
from rubiks import *
from rubiks import rotation, cube_operation, face_turn
from rubiks import cube_analyze

def try_stage(c, s):
    try:
        return list(s(c))
    except base.StageError as e:
        return e.args[1]

s = SimplestSolver()

sc = Cube.solved_cube()
uc = UnpositionedCross()
pc = PositionCross()

scramle_path = "FUF'DUFRU2L'B2FU2LF'DU'"
c = Cube.from_scramble_path(scramle_path)
rc = make_shuffled_cube()
pcc = cube_operation.perform_united_operations(c.copy(), s.solve(c))

mfc = Cube(
        {'B': array([[1, 3, 6],
            [5, 5, 1],
            [5, 4, 3]]),
        'D': array([[1, 2, 5],
            [2, 2, 2],
            [6, 2, 3]]),