Question
Write a C program that displays the initial board and ask the user to choose the coordinates of a cell to insert or delete a
Write a C program that displays the initial board and ask the user to choose the coordinates of a cell to insert or delete a digit. Firstly your program ask the player to choose the level of difficulty of the game 1: Easy 2: Intermediate 3: Hard. and depending on that the program will load one of the game files that is stored as txt The initial board and the final solutions should be stored in files (Empty cells will be stored as 0). Your program implements a function named load_board to read from this file. You implement a function to display the board on the screen named drow_board. Your program ask the player to input the coordinate of the cell to edit. The as the user if he would like to 1: insert a digit or to 2: remove the current value 3: restart the game to the initial board. The player should not be able to delete a cell filled by the initial board. In case of insertion you should check the inserted value dont violate the game rules. After insertion or deletion the board should be drawn again after clearing the screen. Your program count the number of steps needed by the player to solve the puzzle and display this count as a score after the end of the game. This number should be saved. If for next time the same board is chosen display the minimal number of steps taken by players on this board. The web site https://www.sudoku-solutions.com/ contains a large number of games for different levels you can use the Save button to download solved or unsolved boards.
Hints: Load_board function can be used to fill two 2D arrays the first contains the digits for the board and the second - named EDITABLE for example - stores 1 in the index of editable cells (containing . in the file) and 0 for non editable cell. Other functions can use the EDITABLE array for different purposes. For example insert and remove functions can use it to check if the user can modify the requested cell. To calculate the score you can count the nonzero elements in EDITABLE to estimate the minimum number of iteration needed to solve the board.
Note: use only integer data type
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