From e0170a538f0cbe812765af73c37a9bfc15f68e7b Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:15:49 +0100 Subject: [PATCH] Commit 17 code --- src/main/c/sudoku.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 93ec660..560e174 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -124,6 +124,104 @@ int availableLevels[3][3][SIZE][SIZE] = { } }; +int solutionLevels[3][3][SIZE][SIZE] = { + + { //easy + {{4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}, + + {{4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8, 1, 5, 3, 4, 6}, + {3, 4, 8, 2, 6, 9, 5, 1, 7}, + {5, 1, 6, 7, 4, 3, 2, 9, 8}}, + + {{4, 7, 3, 6, 2, 1, 8, 5, 9}, + {6, 8, 5, 9, 7, 4, 1, 3, 2}, + {9, 2, 1, 5, 3, 8, 7, 6, 4}, + {7, 6, 9, 3, 5, 2, 4, 8, 1}, + {8, 5, 4, 1, 9, 7, 6, 2, 3}, + {1, 3, 2, 4, 8, 6, 9, 7, 5}, + {2, 9, 7, 8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