Compare commits

..

No commits in common. "8f387ff781bfbc151e46ef614cb25f03998ccae0" and "fcb33c53ba8a487cf8c03d4337f96b90e16de0fe" have entirely different histories.

View File

@ -88,6 +88,27 @@ void printDumpSudoku() {
printf("+-------+-------+-------+\n");
}
void printDumpQuadrat(int q[]) {
for (int row = 0; row < 3; row++) {
if (row % 3 == 0) {
printf("+-------+\n");
}
for (int col = 0; col < 3; col++) {
if (col % 3 == 0) {
if (col != 0) {
printf(" ");
}
printf("|");
}
int f = calculateField(row, col);
printf(" %d", q[f]);
}
printf(" |\n");
}
printf("+-------+\n");
}
// checks if this value is present anywhere in the row
bool isInRow(int row, int val) {
for (int col = 0; col < 9; col++) {
@ -228,7 +249,7 @@ bool isInQuadrat(int q, int val) {
void setValue(int q, int f, int val) {
sudoku[q][f] = val;
printf("=> setting %d in Q %d; F %d\n", val, q, f);
//printDumpSudoku();
printDumpSudoku();
}
int main() {
@ -284,6 +305,7 @@ int main() {
}
// check if only one field is left undefined -> hast to be the one special value
int undefinedFound = VALUE_UNDEFINED;
for (int f = 0; f < 9; f++) {
// keep in mind that sudoku array might have changed since evaluation
// -> ignore already set values
@ -301,5 +323,5 @@ int main() {
}
} while (somethingChanged);
printDumpSudoku();
// next step: muss in Feld X sein, weil alle anderen Felder irgendwie anders belegt sein müssen (aber noch nicht sind)
}