Simply click the flag, and the process will begin. The AI does not know what value to shoot at to put the hoop in, but it knows how far away the hoop is. As it gets a higher streak, it reduces randomness in the other balls. The green ball is always going to go to what the best outcome would be, the other ones go around it, and pink ones go completely randomly.
This took forever to make. I hope you enjoy!