From the Free Press: Sudoku is a number-placing puzzle based on a 9x9 grid with several given numbers. The object is to place the numbers 1 to 9 in the empty squares so that each row, each column and each 3x3 box contains the same number only once.

In this assignment you are to write a Sudoku Checker Program that reads in values from a file and initializes a 2-dimensional (9x9) array with those values. The code for reading the file values into an array is available on D2L. You may and should incorporate this code into your submission. You will, of course, have to modify this code.

Your program must include implementations of the following static methods:

public static boolean rowsAreValid(int[][] array)
public static boolean columnsAreValid(int[][] array)
public static boolean regionsAreValid(int[][] array)
public static boolean puzzleIsValid(int[][] array)

You may and should implement other helper methods. Hint: A rowIsValid() method would, e.g., be perfectly in order.

Note that when you implement these methods, you may NOT use any arithmetic on the values in a row, column or region! E.g., the sum of the values in a row, column or region of a valid sudoku puzzle is 45. You are NOT allowed to simply sup up the values in a row, column or region and check if that sum is 45.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.