CPSC 170 Sub Post Lab 9
Sudoku Puzzle
Due Before Class on Friday, March 23rd

The post lab 9 assignment is to create a program that can validate sudoku puzzles, because nobody wants to try to solve a puzzle with no solutions. The file SudokuPuzzle.java contains a class that represents a sudoku puzzle as a 9x9 array of ints where empty cells are represented as 0. The class has a constructor that takes a two dimensional array of ints that represents a sudoku puzzle and a toString method. You must complete the validMove method. The method takes the indices of a cell, the row and column, and a value to test. The method should return true if putting the specified value into the specified cell is a valid move and false otherwise. Note, the method should not actually change the instance data. A move is valid if it does not violate any of the rules of a sudoku puzzle:

  1. Only the numbers 0 through 9 can be in a cell.
  2. The numbers 1 through 9 can appear only once each in a row.
  3. The numbers 1 through 9 can appear only once each in a column.
  4. The numbers 1 through 9 can appear only once each in a sub-grid.

Include in your code submission a program that tests your validMove method. The program should create a SudokuPuzzle with a two-dimensional array of ints. It should repeatedly print the result of calling the validMove method and the expected result of each call.

Submission: Submit your code as a zip file with your name as the zip file name on the course Inquire site.