I have a recursive function for moving some circles on a canvas. Overed circle is enlarged (zoom in) and all the other circles is pushed away. Pushed circles push other circles
1) I can not implement iteration because of unknown count of operations needed;
Well, I have not looked at your code, but a general avoidance of linear recursion (you have a linear one here) looks like this:
while (1 == 1) {
if (breakcondition)
break;
doSomeCode()
}
So you do not have to know the exact number of iterations like in the for
- loop case.