Browse Source

refactoring: 10

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

9
src/main/c/sudoku.c

@ -3,6 +3,7 @@
#include <stdbool.h>
#include <string.h>
#define SIZE_OF_GAMEBORD_AXIS_X 9
#define SIZE_OF_GAMEBORD_AXIS_Y 9
#define EMPTY 0
@ -15,7 +16,7 @@ int selected_level;
void Game_loop(); //is instead of main
void Level_Pool(int difficulty);
void selectLevel(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]);
void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]);
void initializeGrid(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]);
void create_playing_field(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y], int difficulty, int level);
void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]);
@ -242,7 +243,7 @@ void Game_loop() {
if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') {
Level_Pool(difficulty);
selectLevel(grid);
Level_Selection(grid);
Player_actions_for_playing(grid);
} else {
printf("Invalid input. Please enter a number between 1 and 3.\n");
@ -260,7 +261,7 @@ void Level_Pool(int difficulty) {
void selectLevel(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) {
void Level_Selection(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y]) {
int level = 0;
printf("\nSelect a level:\n");
while (true){
@ -350,7 +351,7 @@ void Player_actions_for_playing(int grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBO
check_if_Sudoku_solved(grid);
break;
case 5:
selectLevel(grid);
Level_Selection(grid);
break;
case 6:
printf("Exiting Sudoku program.\n");

Loading…
Cancel
Save