Page 1 of 1

Loop Iterations Limit? Changed in Revolution 2.9?

Posted: Sat Apr 05, 2008 3:36 pm
by stephenmcnutt
I've written a program that generates Sudoku puzzles, and it uses a trial-and-error approach, a loop that starts itself over (called recursion???) whenever it finds there's no possible digit to assign to one of the 81 spaces.

I've noticed that it throws an error when the process takes too long. I put in a counter. Sure enough, if it can generate the puzzle in fewer than 451 loops, great, but at 451 Revolution seems to tap it on the shoulder and say, "Sorry pal. You had your chance." It throws a "Can't Find Handler" error (for the handler it's just finished using 450 times, so I know the problem isn't really that it can't find the handler).

My question is this: Am I right in thinking there's a built in loop limit? I know how to get around the limit. I figure I'll just have it jump out after 450 tries then start over. I'm just curious about whether this limit exists and my theory is right.

Also, I noticed after installing Revolution 2.9 that this apparent loop limit changed. It's 451 now, but it used to be either 468 or 486. I can't remember which.

Curiously,
Steve McNutt

Posted: Sat Apr 05, 2008 8:28 pm
by malte
Hi,

yes, such a property exists. Look up recursionlimit in the docs. However, usually the error you should see would be "recursionlimit reached". If you get a can't find handler error, maybe something else is wrong. You try wrapping your repeat loop into a try / catch control structure and post the error you caught here. Than we might be able to tell you a bit more. (The most helpful would be to post the code though)

All the best,

Malte