All pastes #264837 Raw Edit

Stuff

public text v1 · immutable
·published 2006-12-02 19:46 UTC
rendered paste body
public class SudokuChecker
{
  private int[][] sudoku;
   public SudokuChecker(int[][] grid)
   {
     this.sudoku = grid;
   }

   public boolean isValid()
   {
     boolean valid = false;
     if (this.sudoku == null)
     {
     } else
     {
       if(this.sudoku.length != this.sudoku[0].length)
       {
       } else if (this.checkSub() && this.checkCol() && this.checkRow())
       {
         valid = true;
       } else
       {
       }
     }
     return valid;
   }
   
   private boolean checkSub()
   {
     boolean subsquare = true;
     return subsquare;
   }
   
   private boolean checkRow()
   {
     boolean row = false;
     int check1 = 0;
     int check2 = 0;
     for( int i = 0; i < this.sudoku.length - 1; i++)
     {
       for( int j = 0; j < this.sudoku[i].length - 2; j++)
       {
         check1 = this.sudoku[i][j];
         for( int k = j + 1; k < this.sudoku[i].length - 1; k++)
         {
           check2 = this.sudoku[i][k];
           if (check1 == check2)
           {
             break;
           } else
           {
             row = true;
           }
         }
       }
     }
     return row;
   }
   
   private boolean checkCol()
   {
     boolean col = true;
     return col;
   }
}