Question

The logic puzzle known as Sudoku has become very popular recently. Although Sudoku puzzles can come in a variety of sizes, th

Suppose we want to construct an agent to solve any given 3 x 3 Sudoku puzzle. Given an empty starting grid there are 6,670,90

F 7 А 1 6 D BE 1 A 9 F 0 с 0 5 с 8 5 D7 E 4 BEA 7860 1 C с E 2 B A E 0 5 2 F 7 48 D с E 9 2 9 1 D A 0 D А 9 B 9 B F7B-E-A-1--

Programming Language: JAVA

Construct a program that uses an agent to solve a Sudoku puzzle as a Constraint Satisfaction Problem, with the following guidelines:

1. Since 3 x 3 puzzles are too trivial for a computer, your program should use 4 x 4 puzzles (also known as Super Sudoku puzzles; see Figure 2 for an example).

2. The program should read a Sudoku puzzle from a text file. The user should be able to browse the file system to select this file. See Figure 2 for the format the text file should obey. Please be sure you follow this format, as I will test your program by loading my own test puzzles. How you represent the puzzle within your program is entirely up to you.

3. You do not need to generalize your program to cover other sizes of Sudoku puzzles, so you can assume all puzzles tested will be of the 4 x 4 variety.

4. Any set of 16 unique symbols can be used for a 4 x 4 Sudoku puzzle. The standard set consists of the same characters used in hexadecimal arithmetic (numerals 0-9 plus letters A-F). This is the symbol set I will use in my tests. You may use any symbols you wish, but make sure your program can handle any set of 16 unique characters that can be represented in a text file. In keeping with the standard CSP terminology, I will refer to the cells in the puzzle as the variables, and the chosen domain of valid characters as the values.

5. Build 2 separate agents for solving the puzzles: a. An uninformed agent that attempts to solve the puzzle by starting with the first empty cell and progressing from left to right, top to bottom. This is considered the default variable selector. b. A CSP agent that uses the MRV heuristic to reduce the size of the search space. The order in which cells should be assigned using this heuristic is in order of increasing number of possible values. The number of possible values for a given cell is determined by looking at the row, column, and box that have that cell in common, and subtracting from 16 the number of unique values that are already present. The range can be anywhere from 1 to 16 for an empty cell.

6. You may find it useful to implement the backtracking search algorithm. This is not a strict requirement, but this algorithm is a good, general purpose backtracking search that is suitable for CSPs.

7. To measure the relative efficiencies of the two agents, incorporate the ability to maintain counts of the total numbers of cell assignments attempted using each method of selecting variables to assign. Feel free to measure the actual running time if you wish, but counting the total number of attempted variable assignments will give the best, implementation-independent estimate of relative efficiency.

Test both agents on a variety of 4 x 4 Sudoku puzzles

1. Use at least 5 different puzzles in your tests. Try to ensure the puzzles have different levels of difficulty.

2. Compare the results of your two agents on each puzzle you test.

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Programming Language: JAVA Construct a program that uses an agent to solve a Sudoku puzzle as...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • JAVA Sudoku.java This class does the work of solving the Sudoku puzzle, as well as containing...

    JAVA Sudoku.java This class does the work of solving the Sudoku puzzle, as well as containing the main method to provide a text-based user interface. Stores a Board object which it uses in solving. It should also track statistics about the solving process: the number of recursive calls made, and the number of "backups" that had to be done. public Sudoku( Scanner sc ) Constructor for the Sudoku class. Initializes the board and other instance variables. public boolean solve( Location...

  • Starting code: #include <stdio.h> #include <stdbool.h> #include <assert.h> bool checkSudoku(int sudoku[9][9]) { //code goes here }...

    Starting code: #include <stdio.h> #include <stdbool.h> #include <assert.h> bool checkSudoku(int sudoku[9][9]) { //code goes here } int main() { int sudoku[9][9] = {{7, 3, 5, 6, 1, 4, 8, 9, 2}, {8, 4, 2, 9, 7, 3, 5, 6, 1}, {9, 6, 1, 2, 8, 5, 3, 7, 4}, {2, 8, 6, 3, 4, 9, 1, 5, 7}, {4, 1, 3, 8, 5, 7, 9, 2, 6}, {5, 7, 9, 1, 2, 6, 4, 3, 8}, {1, 5, 7, 4,...

  • Need help with java In this program you will use a Stack to implement backtracking to solve Sudok...

    need help with java In this program you will use a Stack to implement backtracking to solve Sudoku puzzles. Part I. Implement the stack class.  Created a generic, singly-linked implementation of a Stack with a topPtr as the only instance variable. Implement the following methods only: public MyStack() //the constructor should simply set the topPtr to null public void push(E e) public E pop()  Test your class thoroughly before using it within the soduku program Part II. Create...

  • Write a JAVA program to solve a sudoku! Given a partially filled 9×9 2D array ‘grid[9][9]’,...

    Write a JAVA program to solve a sudoku! Given a partially filled 9×9 2D array ‘grid[9][9]’, the goal is to assign digits (from 1 to 9) to the empty cells so that every row, column, and subgrid of size 3×3 contains exactly one instance of the digits from 1 to 9. I have posted 3 input files: sudoku1.txt, sudoku2.txt and sudoku3.txt Problem Analysis & Design - Think about how you will need to solve this problem. You should do an...

  • C language Credit for work. Please design a multithreaded application in C with Pthreads - it...

    C language Credit for work. Please design a multithreaded application in C with Pthreads - it determines whether the solution to a Sudoku puzzle is valid. Validate two puzzles In your program, please hard-code the following two 9x9 grids (say in two variables puzzle1 and puzzle2), and determine if each solution is valid. While each grid should be validated by multiple parallel threads, you can validate puzzle1 and then puzzle2 in sequential order (as illustrated) by a single invocation of...

  • C PROGRAMMING You must write a C program to check the validity of a Sudoku solution. Follow the link to know more about...

    C PROGRAMMING You must write a C program to check the validity of a Sudoku solution. Follow the link to know more about Sudoku: https://www.bigfishgames.com/blog/how-to-solve-sudoku-puzzles-quickly-andreliably/ You must at least do the following: 1- Ask the user to provide a minimum of first two rows of the Sudoku grid. For the rest of the entries, you should use random number generator. 2- Use appropriate logic to make sure random number generator generates distinct set of valid integers! 3- It should be...

  • Programming Language: Java Please write a program that uses a recursive algorithm to compute the determinant...

    Programming Language: Java Please write a program that uses a recursive algorithm to compute the determinant of a matrix. It should read the order of the matrix, read the matrix, print it out, compute, and print the determinant. Your program should be able to evaluate multiple matrices on a single execution. For class purposes, your program should handle matrices up to and including those of order 6. You are required to use an array for this problem. Your solution must...

  • In C Programming: Declare a minimum size data structure to store the values of a Sudoko...

    In C Programming: Declare a minimum size data structure to store the values of a Sudoko puzzle (suppose empty cells will have the value of 0 while the other cells will have values from 1 to 9). Then ask user if he/she wants to enter data for a sudoku puzzle or a sudoku solution. Suppose user enters 1 to enter a puzzle; or 2 to enter a solution to be checked. Write/call a function that asks user to enter the...

  • USE THE PYTHON ONLY Sudoku Game Check Please write a Python program to check a Sudoku...

    USE THE PYTHON ONLY Sudoku Game Check Please write a Python program to check a Sudoku game and show its result in detail. This is an application program of using 2-dimensional arrays or lists. Each array or list is a game board of 9 x 9. Your program must check the 9 x 9 game board, and report all the problems among 9 rows, 9 columns, and 9 squares. As you can see, you must pre-load the following four games...

  • Sudoku Game Real Please write a Java program to play a Sudoku game and show its...

    Sudoku Game Real Please write a Java program to play a Sudoku game and show its winning result. This is an application program of using 2-dimensional arrays.   Each array is for a game board of 9 x 9. Your program must know how to play Sudoku game and complete the game with a winning result. The following is a sample test, which must be all your test cases. As you can see, you must pre-load the following 4 games into...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT