BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

AI代写|COMS 4701 Artificial Intelligence Homework 3: Coding – CSPs

AI代写|COMS 4701 Artificial Intelligence Homework 3: Coding – CSPs

本次美国作业是一个人工智能编程的AI代写assignment

 

I. Introduction

The objective of Sudoku is to fill a 9×9 grid with the numbers 1-9 so that each column, row, and 3×3 sub-grid (or
box) contains one of each digit. You may try out the game here: sudoku.com. Sudoku has 81 variables, i.e. 81
tiles. The variables are named by row and column, and are valued from 1 to 9 subject to the constraints that no
two cells in the same row, column, or box may be the same.

Frame your problem in terms of variables, domains, and constraints. We suggest representing a Sudoku board
with a Python dictionary, where each key is a variable name based on location, and value of the tile placed there.

Using variable names Al… A9… I1… I9, the board above has:

• sudoku dict[“B1”] = 2, and
• sudoku dict[“E2”] = 9.

We give value zero to a tile that has not yet been filled.

Executing your program

Your program will be executed as follows:

$ python3 sudoku.py <input string>

In the starter zip, sudokus start.txt, contains hundreds of sample unsolved Sudoku boards, and sudokus finish.txt
the corresponding solutions. Each board is represented as a single line of text, starting from the top-left corner of
the board, and listed left-to-right, top-to-bottom.

The first board in sudokus start.txt is represented as the string:

003020600900305001001806400008102900700000008006708200002609500800203009005010300

Which is equivalent to:

0 0 3 0 2 0 6 0 0
9 0 0 3 0 5 0 0 1
0 0 1 8 0 6 4 0 0
0 0 8 1 0 2 9 0 0
7 0 0 0 0 0 0 0 8
0 0 6 7 0 8 2 0 0
0 0 2 6 0 9 5 0 0
8 0 0 2 0 3 0 0 9
0 0 5 0 1 0 3 0 0

Your program will generate output.txt, containing a single line of text representing the finished Sudoku board.
E.g.:

483921657967345821251876493548132976729564138136798245372689514814253769695417382

Test your program using sudokus finish.txt, which contains the solved versions of all of the same puzzles.

bestdaixie

评论已关闭。