Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 dont 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 k 2 by k2 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).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago