I found that, after I fixed the syntax error (blame Game Maker for that one, they allow you to do something like "if(x=2)" in their scripting), the function almost works correctly. To be more specific, the horizontal and vertical checks work fine, but not the square check. I know this because I did 3 things:
1. I did the sudoku by hand to find what numbers go where.
2. I used 'dispothermatrix()' to look at smatrix, and I did by hand what I want the program to do (I myself looked at rows, columns, and boxes, to find 0s that were standing alone) and I found that all of these were the correct numbers as checked by the sudoku I had completed.
3. Within 'if (correctnum==true)' I added something that would tell me the coordinates and the numbers of the spots that passed the tests, and which test it passed (horizontal, vertical, or square). Some of these matched my hand-solved sudoku, some didn't. I found that the ones that did match were the ones that passed either the horizontal or the vertical tests, and the ones that didn't match were the ones that passed the square test.
Thus, my problem should be in the square test. However, as far as checking every spot in the square, the programming is exactly the same as the one to set smatrix, which works fine. Also, as far as the test, it is the same as the horizontal and vertical tests.
The code to set the squares in smatrix (working)
Code:
int cx=x-((x-1)%3),
cy=y-((y-1)%3);
for(int e=0;e<3;e++)
for(int i=0;i<3;i++)
smatrix[cx+e][cy+i][currentnum]=1;
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.