Example #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
    )
Example #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
    )
Example #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
    )
def test_rotate_face_ccw():
    face = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

    expected_rotated_face = [[3, 6, 9], [2, 5, 8], [1, 4, 7]]

    rotate_face(face, clockwise=False)
    assert expected_rotated_face == face
Example #5
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_rotate_face_cw():
    face = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

    expected_rotated_face = [[7, 4, 1], [8, 5, 2], [9, 6, 3]]

    rotate_face(face, clockwise=True)
    assert expected_rotated_face == face
Example #7
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)
Example #8
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)
Example #9
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)
Example #10
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_rotate_face_ccw():
    face = [
        [1, 2, 3],
        [4, 5, 6],
        [7, 8, 9]
    ]

    expected_rotated_face = [
        [3, 6, 9],
        [2, 5, 8],
        [1, 4, 7]
    ]

    rotate_face(face, clockwise=False)
    assert expected_rotated_face == face
def test_rotate_face_cw():
    face = [
        [1, 2, 3],
        [4, 5, 6],
        [7, 8, 9]
    ]

    expected_rotated_face = [
        [7, 4, 1],
        [8, 5, 2],
        [9, 6, 3]
    ]

    rotate_face(face, clockwise=True)
    assert expected_rotated_face == face