Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Generating Sudoku Board PYTHON PLS Task 2: Generting Suduko board In the template file, we provided solutions function, this function will return possible solutions to
Generating Sudoku Board PYTHON PLS
Task 2: Generting Suduko board In the template file, we provided solutions function, this function will return possible solutions to the board as a list of solutions, where each item in this list is a solved board. You don't need to understand how this function works. However, you just need to understand the format of its input and output as you will use this function to extend the behaviour of the play function such that on input 'g' k, (i.e., the letter g followed by an integer k> 1), or 'generate' k, it generates a new random kby k? Sudoku board such that the board has a unique solution. Hints: Think of a good decomposition of this problem. Some ideas for useful subproblems are, e.g., generating a random full game board that is valid (i.e., satisfies the placement constraints of Sudoku) and checking whether a given partially filled board has a unique solution. The partially filled board can be generated by repeatedly removing a number from the board (set that cell to 0) and see if the resulting game board would still have a unique solution. The number to be removed can be selected randomly. You should aim to remove as much numbers as possible. For randomising you can use the function shuffle from the random module. Your initial solutions to this problem are likely rather slow. Make sure to first test with the smallest board size (k =2). 4Step 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