Answered You can hire a professional tutor to get the answer.
Artificial Intelligence in PYTHON Once you have completed the assignment, you should submit your file on Eniac using the following turnin command,
Artificial Intelligence in PYTHON
Once you have completed the assignment, you should submit your file on Eniac using the following turnin command, where the flags -c and -p stand for "course" and "project", respectively.
turnin -c cis521 -p hw4 homework4.py
Sudoku
In the game of Sudoku, you are given a partially-filled 9×99×9 grid, grouped into a 3×33×3 grid of 3×33×3 blocks. The objective is to fill each square with a digit from 1 to 9, subject to the requirement that each row, column, and block must contain each digit exactly once.
In this section, you will implement the AC-3 constraint satisfaction algorithm for Sudoku, along with two extensions that will combine to form a total and efficient solver.
A number of puzzles have been made available on the course website for testing, including:
- An easy-difficulty puzzle: easy.txt.
- Four medium-difficulty puzzles: medium1.txt, medium2.txt, medium3.txt, and medium4.txt.
- Two hard-difficulty puzzles: hard1.txt and hard2.txt.
1. In this section, we will view a Sudoku puzzle not from the perspective of its grid layout, but more abstractly as a collection of cells. Accordingly, we will represent it internally as a dictionary mapping from cells, i.e. (row, column) pairs, to sets of possible values.
In the Sudoku class, compute an initialization method __init__(self, board) that stores such a mapping for future use. Also compute method get_values(self, cell) that returns the set of values currently available at a particular cell.
In addition, compute a function read_board(path) that reads the board specified by the file at the given path and returns it as a dictionary. Sudoku puzzles will be represented textually as 9 lines of 9 characters each, corresponding to the rows of the board, where a digit between "1" and "9" denotes a cell containing a fixed value, and an asterisk "*" denotes a blank cell that could contain any digit.