Sudoku Solver Assignment for CSE 30 at University of California, San Diego, Assignments of Computer Science

Information about a programming assignment for the computer organization and systems programming course (cse 30) at the university of california, san diego. Students are required to write a sudoku solver for 'easy' puzzles using mips language. A sample puzzle, output format, and hints for completing the assignment.

Typology: Assignments

Pre 2010

Uploaded on 03/28/2010

koofers-user-17r-1
koofers-user-17r-1 🇺🇸

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
University of California, San Diego
Dept. of Computer Science and Engineering
CSE 30 – Computer Organization and Systems Programming
Programming Assignment #3 – Sudoku Solver
Due 2pm Tuesday November 3
Sudoku is a logic-based number-placement puzzle. The objective is to fill a 9×9 grid so
that each column, each row, and each of the nine 3×3 boxes (also called blocks or
regions) contain the digits from 1 to 9 only one time each. The puzzle setter provides a
partially completed grid.
Consider the puzzle below and its solution:
The initial board is represented in row major order as an 81 byte array as shown below.
The entries ‘0’ denote empty spaces.
board: .byte 7, 9, 0, 0, 0, 0, 3, 0, 0
.byte 0, 0, 0, 0, 0, 6, 9, 0, 0
.byte 8, 0, 0, 0, 3, 0, 0, 7, 6
.byte 0, 0, 0, 0, 0, 5, 0, 0, 2
.byte 0, 0, 5, 4, 1, 8, 7, 0, 0
.byte 4, 0, 0, 7, 0, 0, 0, 0, 0
.byte 6, 1, 0, 0, 9, 0, 0, 0, 8
.byte 0, 0, 2, 3, 0, 0, 0, 0, 0
.byte 0, 0, 9, 0, 0, 0, 0, 5, 4
Your assignment is to create a solver for “easy” Sudoku puzzles, i.e., ones that you do not
have to “guess” then backtrack to solve.
pf2

Partial preview of the text

Download Sudoku Solver Assignment for CSE 30 at University of California, San Diego and more Assignments Computer Science in PDF only on Docsity!

University of California, San Diego Dept. of Computer Science and Engineering CSE 30 – Computer Organization and Systems Programming Programming Assignment #3 – Sudoku Solver Due 2pm Tuesday November 3 Sudoku is a logic-based number-placement puzzle. The objective is to fill a 9×9 grid so that each column, each row, and each of the nine 3×3 boxes (also called blocks or regions) contain the digits from 1 to 9 only one time each. The puzzle setter provides a partially completed grid. Consider the puzzle below and its solution: The initial board is represented in row major order as an 81 byte array as shown below. The entries ‘0’ denote empty spaces. board: .byte 7, 9, 0, 0, 0, 0, 3, 0, 0 .byte 0, 0, 0, 0, 0, 6, 9, 0, 0 .byte 8, 0, 0, 0, 3, 0, 0, 7, 6 .byte 0, 0, 0, 0, 0, 5, 0, 0, 2 .byte 0, 0, 5, 4, 1, 8, 7, 0, 0 .byte 4, 0, 0, 7, 0, 0, 0, 0, 0 .byte 6, 1, 0, 0, 9, 0, 0, 0, 8 .byte 0, 0, 2, 3, 0, 0, 0, 0, 0 .byte 0, 0, 9, 0, 0, 0, 0, 5, 4 Your assignment is to create a solver for “easy” Sudoku puzzles, i.e., ones that you do not have to “guess” then backtrack to solve.

Your program should output the final results as follows: 7, 9, 6, 8, 5, 4, 3, 2, 1 2, 4, 3, 1, 7, 6, 9, 8, 5 8, 5, 1, 2, 3, 9, 4 , 7, 6 1, 3, 7, 9, 6, 5, 8, 4, 2 9, 2, 5, 4, 1, 8, 7, 6, 3 4, 6, 8, 7, 2, 3, 5, 1, 9 6, 1, 4, 5, 9, 7, 2, 3, 8 5, 8, 2, 3, 4, 1, 6, 9, 7 3, 7, 9, 6, 8, 2, 1 , 5, 4 You can find skeleton code for the project at: http://www.cse.ucsd.edu/~kastner/cse30/sudoku.s Hints and General Comments:

  1. START EARLY! You will not be able to finish this the night before. It is unlikely that you will be able to complete this even if you start a few days before the due date.
  2. As with any programming project, it is important that you work incrementally and test your code often. You should start your program by creating a function that will output the board data in the required format. This is worth 20% of your grade and will help you with debugging later. Refer to FIR_Filter.s file from Problem Set #3 for sample code on how to output to the display.
  3. It is very important to comment your code. This is largely for your own sake.
  4. Your project will be graded by changing the input array and checking your corresponding output. There are countless examples of Sudoku puzzles on the Internet. You should test your program with more than just this sample puzzle.
  5. It is a good idea to first think out the algorithm for your solution. For example, write C code to test and debug your ideas. Then translate that C code to MIPS. It is infinitely easier to modify your C code than it is your MIPS code.
  6. Obligatory cheating statement: There are undoubtedly many solutions for this in many languages (I’m sure even for MIPS) floating around on the web. Remember that you are responsible for understanding every line of code that you have written. If you cannot explain to someone, on the spot, what every piece of your code does, then that is considered cheating (this is another reason why it is important to comment your code – so that you can remember what you have written at a later date). It is OK to talk with others in the class about your ideas for algorithms. It is not OK to share code. You should write every line of code yourself. Finally, your code will be compared with others using software, which also include any solutions that may be on the Internet as well as solutions from previous years.