I am working on a simple stack to create a sudoku. I have a button to populate the grid with random numbers (which follows the requirements of no duplication in single row, column or block of 9) and it hangs somewhere in the middle. The main work is done inside a double repeat loop, one to work across, and the other to go down. if the upper limit on the "repeat with x = 1 to 9" is reduced to 5 or 6 for testing, it works fine, but if it is 7 or higher it hangs. When I press ESC, it fills the grid as far as it's gone, but the numbers don't show as it goes, which they do if I use the debugger. There is no lock screen in the script.
I'm sure my script is amateurish and inefficient, but it's plenty fast enough when it completes. The debugger would indicate that it's not stuck trying to find an acceptable number, ie too many times around inside looking for one which hasn't been used. Could it be a memory buffer issue? I have 4 GB of RAM on a 2008 MacBook. Running it after a restart didn't make any difference.
Thanks,
Dave
Repeat loop hanging
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Repeat loop hanging
Hi.
Whatever your issue, it is not one of memory.
How do you exit the repeat loop? That is really the question. Hard to tell what is wrong without seeing the script. That it works with smaller numbers may mean it just doesn't find a condition with larger ones that satisfies whatever method you designed to allow it to finish.
Bet you...
Craig Newman
Whatever your issue, it is not one of memory.
How do you exit the repeat loop? That is really the question. Hard to tell what is wrong without seeing the script. That it works with smaller numbers may mean it just doesn't find a condition with larger ones that satisfies whatever method you designed to allow it to finish.
Bet you...
Craig Newman
Re: Repeat loop hanging
Thanks for the reply.
After I copied a portion of the script into this window, I had a closer look, and I think I found the problem. I'll work on it some more tomorrow.
Thanks anyway,
Dave
After I copied a portion of the script into this window, I had a closer look, and I think I found the problem. I'll work on it some more tomorrow.
Thanks anyway,
Dave