FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Error in my Sudoku solver. Help!





m0u53m4t
Whenever I run this code it selects the code (highlighted) and says 'Next without for'. I cant work out whats wrong...:

For y = 1 To 3
For x = 1 To 3
noofposs = 0
For pos = 1 To 9
If solution2(ybox * 3 + 1 - y, xbox * 3 + 1 - x)(10) = 0 Then
If solution2(ybox * 3 + 1 - y, xbox * 3 + 1 - x)(pos) = 0 Then
noofposs = noofposs + 1
If noofposs > maxposs Then maxposs = noofposs
If noofposs > maxposs Then xwithmost = x
If noofposs > maxposs Then ywithmost = y
Next pos
Next x
Next y
muggle
Most probably these two `If` statements:
m0u53m4t wrote:
...
If solution2(ybox * 3 + 1 - y, xbox * 3 + 1 - x)(10) = 0 Then
If solution2(ybox * 3 + 1 - y, xbox * 3 + 1 - x)(pos) = 0 Then
...

miss their corresponding `End If ` statements.
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.