Browse Source

Commit 8 code

remotes/origin/Lucas
Lucas Heil 11 months ago
parent
commit
818253186d
  1. 13
      src/main/c/sudoku.c

13
src/main/c/sudoku.c

@ -1,6 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
@ -32,7 +31,7 @@ int availableLevels[3][3][SIZE][SIZE] = {
{1, 0, 0, 4, 0, 6, 0, 0, 0}, {1, 0, 0, 4, 0, 6, 0, 0, 0},
{2, 9, 0, 8, 1, 5, 0, 0, 6}, {2, 9, 0, 8, 1, 5, 0, 0, 6},
{0, 4, 8, 2, 0, 9, 5, 0, 0}, {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}, {{0, 0, 3, 0, 2, 1, 8, 0, 0},
{6, 0, 0, 0, 7, 0, 1, 3, 2}, {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}, {1, 0, 0, 4, 0, 6, 0, 0, 0},
{2, 9, 0, 8, 1, 5, 0, 0, 6}, {2, 9, 0, 8, 1, 5, 0, 0, 6},
{0, 4, 8, 2, 0, 9, 5, 0, 0}, {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}, {{0, 0, 3, 0, 2, 1, 8, 0, 0},
{6, 0, 0, 0, 7, 0, 1, 3, 2}, {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}, {1, 0, 0, 4, 0, 6, 0, 0, 0},
{2, 9, 0, 8, 1, 5, 0, 0, 6}, {2, 9, 0, 8, 1, 5, 0, 0, 6},
{0, 4, 8, 2, 0, 9, 5, 0, 0}, {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 {//medium
{{0, 0, 3, 0, 2, 1, 8, 0, 0}, {{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) { void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level) {
initializeGrid(grid); initializeGrid(grid);
printf("Level is getting initialized"); 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];
}
}
} }

Loading…
Cancel
Save