Exemplo n.º 1
0
    for cube in poly3d_objects:
        if any(rotation[2] == round(vert[rotation[1]]) for poly in cube
               for vert in poly[1]):
            for poly in cube:
                for ind, vert in enumerate(poly[1]):
                    poly[1][ind] = np.matmul(vert, rot)
                poly[0].set_verts([poly[1]])

    fig.canvas.draw_idle()
    return True


ax.set_aspect('equal')
ax.set_xlim3d(-3, 3)
ax.set_ylim3d(-3, 3)
ax.set_zlim3d(-3, 3)
plt.axis('off')
# RIGHT_ALG = [['R', 'Y', 2], ['R', 'B', 2], ['R', 'W', 0], ['R', 'G', 0]] # test1
# RIGHT_ALG = [['W', 'R', 2], ['W', 'B', 2], ['W', 'O', 0], ['W', 'G', 0]]
CUBE = Solution()
SCRAMBLE = CUBE.Scramble()
SCRAMBLE = CUBE.parse_rotation(SCRAMBLE, 1)
ROTATIONS = CUBE.Solve()
print(len(ROTATIONS))
ROTATION_ORDER = CUBE.parse_rotation(ROTATIONS, STEPS) + SCRAMBLE
timer = fig.canvas.new_timer(interval=50)
timer.add_callback(rotation)
timer.start()
plt.show()