Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedGenerating 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). 4

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_2

Step: 3

blur-text-image_3

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

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions