Browse Source

refactoring: 1

remotes/origin/Lucas
Lucas Heil 11 months ago
parent
commit
b918a40c3b
  1. 7
      src/main/c/sudoku.c

7
src/main/c/sudoku.c

@ -9,7 +9,6 @@
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
#define SIZE 9 #define SIZE 9
#define EMPTY 0 #define EMPTY 0
#define LEVEL_NUMBER 3 #define LEVEL_NUMBER 3
@ -20,7 +19,7 @@ int selected_level;
void startSudoku(); //is instead of main void startSudoku(); //is instead of main
void availableLevelsFunction(int difficulty);
void Level_Pool(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);
@ -247,7 +246,7 @@ void startSudoku() {
difficulty = input[0] - '0'; // Convert the first character to an integer difficulty = input[0] - '0'; // Convert the first character to an integer
if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') {
availableLevelsFunction(difficulty);
Level_Pool(difficulty);
selectLevel(grid); selectLevel(grid);
turnFunction(grid); turnFunction(grid);
} else { } else {
@ -257,7 +256,7 @@ void startSudoku() {
} }
} }
void availableLevelsFunction(int difficulty) {
void Level_Pool(int difficulty) {
printf("\nAvailable Levels for Difficulty %d:\n", difficulty); printf("\nAvailable Levels for Difficulty %d:\n", difficulty);
for (int i = 0; i < LEVEL_NUMBER; i++) { for (int i = 0; i < LEVEL_NUMBER; i++) {
printf("%d. Level %d\n", i + 1, i + 1); printf("%d. Level %d\n", i + 1, i + 1);

Loading…
Cancel
Save