When I did my puzzle Detective Chess for mobile, I had to take the search tree out of recursion entirely and fake it with my own stack. The calculation method would do a fixed number of iterations (taking something on the order of half a second, which would be monitored over the first few passes), then return so that an update could be performed. It would then be called again unless it has reported finished. I always wondered whether there is a neat way to encapsulate this process in a class for chess games etc., but I never got around to trying it,
Anyway, something like that might be useful too, though it's more for a single recursive process than for general use of recursion.
|