aboutsummaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/sudoku.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/c/sudoku.c b/c/sudoku.c
index 5982f8f..3d5b2d9 100644
--- a/c/sudoku.c
+++ b/c/sudoku.c
@@ -33,7 +33,7 @@ bool inCol(int i, int n)
bool inRow(int i, int n)
{
- int row = (i/9) * 9 + 1;
+ int row = (i/9) * 9;
for(int j = row; j < row + 9; j++) {
if(PUZZLE[j] - '0' == n && i != j)
return true;
@@ -57,7 +57,7 @@ bool solve()
continue;
PUZZLE[i] = n + '0';
- if(solve(PUZZLE))
+ if(solve())
return true;
}
@@ -68,6 +68,8 @@ bool solve()
next:
i++;
}
+
+ return PUZZLE;
}