|
|
@ -34,3 +34,27 @@ bool panduan(int board[9][9]) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int board[9][9] = {
|
|
|
|
|
|
|
|
{0, 0, 0, 0, 7, 0, 0, 0, 0},
|
|
|
|
|
|
|
|
{6, 0, 0, 1, 9, 5, 0, 0, 0},
|
|
|
|
|
|
|
|
{0, 9, 8, 0, 0, 0, 0, 6, 0},
|
|
|
|
|
|
|
|
{8, 0, 0, 0, 6, 0, 0, 0, 3},
|
|
|
|
|
|
|
|
{4, 0, 0, 8, 0, 3, 0, 0, 1},
|
|
|
|
|
|
|
|
{7, 0, 0, 0, 2, 0, 0, 0, 6},
|
|
|
|
|
|
|
|
{0, 6, 0, 0, 0, 0, 2, 8, 0},
|
|
|
|
|
|
|
|
{0, 0, 0, 4, 1, 9, 0, 0, 5},
|
|
|
|
|
|
|
|
{0, 0, 0, 0, 8, 0, 0, 7, 9}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
if (panduan(board))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("True: Valid initial Sudoku matrix!\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("False: Invalid initial Sudoku matrix!\n");
|
|
|
|
|
|
|
|
printf("No solution!\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|