Question
Use a two-dimensional array of integers to store the current state of the puzzle. In this array, values of 1-9 represent user input, and a
Use a two-dimensional array of integers to store the current state of the puzzle. In this array, values of 1-9 represent user input, and a value of -1 represents a space with no current value. As the game is played, update this array based on user input. You must use dynamic memory allocation to store this array.
Create .c and .h files Use files suduko_puzzle.txt (example)
*5 *3 -1 -1 *7 -1 -1 -1 -1 *6 -1 -1 *1 *9 *5 -1 -1 -1 -1 *9 *8 -1 -1 -1 -1 *6 -1 *8 -1 -1 -1 *6 -1 -1 -1 *3 *4 -1 -1 *8 -1 *3 -1 -1 *1 *7 -1 -1 -1 *2 -1 -1 -1 *6 -1 *6 -1 -1 -1 -1 *2 *8 -1 -1 -1 -1 *4 *1 *9 -1 -1 *5 -1 -1 -1 -1 *8 -1 -1 *7 *9
and human_input.txt (example)
sudoku_puzzle.txt 1,3,4 1,4,6 1,6,8 -1
The user should be able to set entries in the game board by providing input in the form row, column, value to solve a specific square, or enter -1 to exit the program.
EXAMPLE OF THE OUTPUT: SUDOKU GAME Rules: Fill the 9x9 square such that each row, column, or block contains all of the numbers 1-9 Enter game filename to load: sudoku_puzzle.txt Loading game file sudoku_puzzle.txt Current puzzle has 51 unsolved items 1 2 3 4 5 6 7 8 9 |-----------------------| 1 | 5 3 # | # 7 # | # # # | 2 | 6 # # | 1 9 5 | # # # | 3 | # 9 8 | # # # | # 6 # | |-----------------------| 4 | 8 # # | # 6 # | # # 3 | 5 | 4 # # | 8 # 3 | # # 1 | 6 | 7 # # | # 2 # | # # 6 | |-----------------------| 7 | # 6 # | # # # | 2 8 # | 8 | # # # | 4 1 9 | # # 5 | 9 | # # # | # 8 # | # 7 9 | |-----------------------| Enter row,col,value to solve a square, or -1 to exit
Write code in C language please. Thank you I will give thumbs up. If you have any questions please let me know.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started