Execution a list of functions with Ursina

35 Views Asked by At

I'm writing Python code to solve the Rubik's cube The output is a list of rotations. In other hand I have an interface made with Ursina that shows the cube and can be interacted with using The keyboard. My question is how can I bring the cube to follow the solution from the first code and execute these rotations one after the other only with one button click? Which function in Ursina can I use?

1

There are 1 best solutions below

0
JPhay0001 On

First you start by making the function:

def solve(list_, cube):

    for move in list_:

        #Here you apply one rotation (move) to the cube

Later you create a "input" function to detect the key binding

def input(key):

    if key == "S": #You can put the key you want

       solve(your_list, your_cube)

Because I don't know how you made the cube rotate in your program, I can't give you are more detailed answer, but if you want, you can send me the program here: [email protected]