From 818253186debf50ed4395abc36130751baa305f0 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:13:17 +0100 Subject: [PATCH] Commit 8 code --- src/main/c/sudoku.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index dcdfb7b..f877f62 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -1,6 +1,5 @@ - #include #include #include @@ -32,7 +31,7 @@ int availableLevels[3][3][SIZE][SIZE] = { {1, 0, 0, 4, 0, 6, 0, 0, 0}, {2, 9, 0, 8, 1, 5, 0, 0, 6}, {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 1}}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}, {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -42,7 +41,7 @@ int availableLevels[3][3][SIZE][SIZE] = { {1, 0, 0, 4, 0, 6, 0, 0, 0}, {2, 9, 0, 8, 1, 5, 0, 0, 6}, {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 2}}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}, {{0, 0, 3, 0, 2, 1, 8, 0, 0}, {6, 0, 0, 0, 7, 0, 1, 3, 2}, @@ -52,7 +51,7 @@ int availableLevels[3][3][SIZE][SIZE] = { {1, 0, 0, 4, 0, 6, 0, 0, 0}, {2, 9, 0, 8, 1, 5, 0, 0, 6}, {0, 4, 8, 2, 0, 9, 5, 0, 0}, - {5, 0, 0, 7, 0, 3, 2, 0, 3}}}, + {5, 0, 0, 7, 0, 3, 2, 0, 0}}}, {//medium {{0, 0, 3, 0, 2, 1, 8, 0, 0}, @@ -194,7 +193,11 @@ void initializeGrid(int grid[SIZE][SIZE]) { void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) { initializeGrid(grid); printf("Level is getting initialized"); - + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + grid[i][j] = availableLevels[difficulty - 1][level - 1][i][j]; + } + } }