From 3c7511ddfa46bd5d56f194e011c5a351b7870671 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:20:52 +0100 Subject: [PATCH] Commit 28 code --- src/main/c/sudoku.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index fd4b62d..a9e5590 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -26,6 +26,7 @@ void generateSudoku(int grid[SIZE][SIZE], int difficulty, int level); void turnFunction(int grid[SIZE][SIZE]); void tipFunction(int grid[SIZE][SIZE]); void inputFunction(int grid[SIZE][SIZE]); +void printGrid(int grid[SIZE][SIZE]); int availableLevels[3][3][SIZE][SIZE] = { @@ -317,6 +318,7 @@ void turnFunction(int grid[SIZE][SIZE]) { printf("\nTurn function - Choose an action:\n"); printf("1. Tip function\n"); printf("2. Input function\n"); + printf("3. Print Sudoku grid\n"); int action; @@ -341,7 +343,7 @@ void turnFunction(int grid[SIZE][SIZE]) { inputFunction(grid); break; case 3: - printf("Case 3.\n"); + printGrid(grid); break; case 4: printf("Case 4.\n"); @@ -536,6 +538,16 @@ void inputFunction(int grid[SIZE][SIZE]) { } +void printGrid(int grid[SIZE][SIZE]) { + printf("\nSudoku Grid:\n"); + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + printf("%d ", grid[i][j]); + } + printf("\n"); + } +} + int main(){ startSudoku();