Browse Source

Commit 10 code

main^2
Lucas Heil 11 months ago
committed by Peter Wiebe
parent
commit
d36ef7a70c
  1. 7
      src/main/c/sudoku.c

7
src/main/c/sudoku.c

@ -23,6 +23,7 @@ void availableLevelsFunction(int difficulty);
void selectLevel(int grid[SIZE][SIZE]); void selectLevel(int grid[SIZE][SIZE]);
void initializeGrid(int grid[SIZE][SIZE]); void initializeGrid(int grid[SIZE][SIZE]);
void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level);
void turnFunction(int grid[SIZE][SIZE]);
int availableLevels[3][3][SIZE][SIZE] = { int availableLevels[3][3][SIZE][SIZE] = {
@ -144,6 +145,7 @@ void startSudoku() {
if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') {
availableLevelsFunction(difficulty); availableLevelsFunction(difficulty);
selectLevel(grid); selectLevel(grid);
turnFunction(grid);
} else { } else {
printf("Invalid input. Please enter a number between 1 and 3.\n"); printf("Invalid input. Please enter a number between 1 and 3.\n");
} }
@ -196,7 +198,6 @@ void initializeGrid(int grid[SIZE][SIZE]) {
void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) {
initializeGrid(grid); initializeGrid(grid);
printf("Level is getting initialized");
for (int i = 0; i < SIZE; i++) { for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) { for (int j = 0; j < SIZE; j++) {
grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j];
@ -212,7 +213,9 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) {
} }
void turnFunction(int grid[SIZE][SIZE]) {
printf("\nTurn function - Choose an action:\n");
}

Loading…
Cancel
Save