示例#1
0
def _D(cube, clockwise=True):
    rotate_face(cube.faces[5], clockwise)
    cycle_4(
        faces=[cube.faces[i] for i in [3, 4, 1, 2]],
        edges=[Edge.BOTTOM(), Edge.BOTTOM(), Edge.BOTTOM(), Edge.BOTTOM()],
        clockwise=clockwise
    )
示例#2
0
def _F(cube, clockwise=True):
    rotate_face(cube.faces[3], clockwise)
    cycle_4(
        faces=[cube.faces[i] for i in [2, 0, 4, 5]],
        edges=[Edge.RIGHT(ascending_indices=False), Edge.BOTTOM(), Edge.LEFT(), Edge.TOP(ascending_indices=False)],
        clockwise=clockwise
    )
示例#3
0
def _L(cube, clockwise=True):
    rotate_face(cube.faces[2], clockwise)
    cycle_4(
        faces=[cube.faces[i] for i in [3, 5, 1, 0]],
        edges=[Edge.LEFT(), Edge.LEFT(), Edge.RIGHT(ascending_indices=False), Edge.LEFT()],
        clockwise=clockwise
    )
示例#4
0
def _U(cube, clockwise=True):
    rotate_face(cube.faces[0], clockwise)
    cycle_4(
        faces=[cube.faces[i] for i in [2, 1, 4, 3]],
        edges=[Edge.TOP(ascending_indices=False), Edge.TOP(ascending_indices=False), Edge.TOP(ascending_indices=False), Edge.TOP(ascending_indices=False)],
        clockwise=clockwise
    )
示例#5
0
def _D(cube, clockwise=True):
    rotate_face(cube.faces[5], clockwise)
    cycle_4(faces=[cube.faces[i] for i in [3, 4, 1, 2]],
            edges=[Edge.BOTTOM(),
                   Edge.BOTTOM(),
                   Edge.BOTTOM(),
                   Edge.BOTTOM()],
            clockwise=clockwise)
示例#6
0
def _L(cube, clockwise=True):
    rotate_face(cube.faces[2], clockwise)
    cycle_4(faces=[cube.faces[i] for i in [3, 5, 1, 0]],
            edges=[
                Edge.LEFT(),
                Edge.LEFT(),
                Edge.RIGHT(ascending_indices=False),
                Edge.LEFT()
            ],
            clockwise=clockwise)
示例#7
0
def _B(cube, clockwise=True):
    rotate_face(cube.faces[1], clockwise)
    cycle_4(faces=[cube.faces[i] for i in [2, 5, 4, 0]],
            edges=[
                Edge.LEFT(),
                Edge.BOTTOM(),
                Edge.RIGHT(ascending_indices=False),
                Edge.TOP(ascending_indices=False)
            ],
            clockwise=clockwise)
示例#8
0
def _U(cube, clockwise=True):
    rotate_face(cube.faces[0], clockwise)
    cycle_4(faces=[cube.faces[i] for i in [2, 1, 4, 3]],
            edges=[
                Edge.TOP(ascending_indices=False),
                Edge.TOP(ascending_indices=False),
                Edge.TOP(ascending_indices=False),
                Edge.TOP(ascending_indices=False)
            ],
            clockwise=clockwise)
def test_cycle_4_cw_1():
    """
    See `cube_solver.cube`
    faces: 2, 0, 4, 5
    """
    faces = [[
                 [A, B, C],
                 [D, E, F],
                 [G, H, I]
             ], [
                 [J, K, L],
                 [M, N, O],
                 [P, Q, R]
             ], [
                 [S, T, U],
                 [V, W, X],
                 [Y, Z, Z2]
             ], [
                 [A2, B2, C2],
                 [D2, E2, F2],
                 [G2, H2, I2]
             ]]

    edges = [Edge.RIGHT(ascending_indices=False), Edge.BOTTOM(), Edge.LEFT(), Edge.TOP(ascending_indices=False)]
    expected_cycled_faces = [[
                                 [A, B, A2],
                                 [D, E, B2],
                                 [G, H, C2]
                             ], [
                                 [J, K, L],
                                 [M, N, O],
                                 [I, F, C]
                             ], [
                                 [P, T, U],
                                 [Q, W, X],
                                 [R, Z, Z2]
                             ], [
                                 [Y, V, S],
                                 [D2, E2, F2],
                                 [G2, H2, I2]
                             ]]

    cycle_4(faces=faces, edges=edges, clockwise=True)
    assert expected_cycled_faces == faces
def test_cycle_4_cw_1():
    """
    See `cube_solver.cube`
    faces: 2, 0, 4, 5
    """
    faces = [[[A, B, C], [D, E, F], [G, H, I]],
             [[J, K, L], [M, N, O], [P, Q, R]],
             [[S, T, U], [V, W, X], [Y, Z, Z2]],
             [[A2, B2, C2], [D2, E2, F2], [G2, H2, I2]]]

    edges = [
        Edge.RIGHT(ascending_indices=False),
        Edge.BOTTOM(),
        Edge.LEFT(),
        Edge.TOP(ascending_indices=False)
    ]
    expected_cycled_faces = [[[A, B, A2], [D, E, B2], [G, H, C2]],
                             [[J, K, L], [M, N, O], [I, F, C]],
                             [[P, T, U], [Q, W, X], [R, Z, Z2]],
                             [[Y, V, S], [D2, E2, F2], [G2, H2, I2]]]

    cycle_4(faces=faces, edges=edges, clockwise=True)
    assert expected_cycled_faces == faces