Repeat loop hanging

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Repeat loop hanging

Post by dsquance » Fri Jan 03, 2014 2:54 am

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Repeat loop hanging

Post by dunbarx » Fri Jan 03, 2014 7:15 am

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

dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Re: Repeat loop hanging

Post by dsquance » Fri Jan 03, 2014 7:34 am

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

Post Reply