public class GetDataMethods {
int emptycells[];
int rows[]=new int[9];
int cols[]=new int[9];
int[][] newboard =
{{0,0,0,0,6,0,0,0,9},
{0,6,0,0,0,0,3,0,1},
{2,0,0,0,0,9,8,0,0},
{1,9,6,0,0,2,0,0,8},
{0,0,0,3,0,8,0,0,0},
{8,0,0,9,0,0,1,7,5},
{0,0,1,7,0,0,0,0,4},
{6,0,7,0,0,0,0,8,0},
{4,0,0,0,9,0,0,0,0}};
// The Possible Values
public int possibilityboard[][];
int value;
public int[] getnumbersinrow(int row,int[][]board){
for(int y = 0; y<=8;y++){
rows[y]=newboard[row][y];
}
return rows;
}
public int getCell(int i, int j) {
return newboard[i][j];
}
public int[] getNeighbourhood(int i, int j) {
int left = (i/3)*3;
int top = (j/3)*3;
int[] neighbourhood = {getCell(left, top),
getCell(left, top+1),
getCell(left, top+2),
getCell(left+1, top),
getCell(left+1, top+1),
getCell(left+1, top+2),
getCell(left+2, top),
getCell(left+2, top+1),
getCell(left+2, top+2)};
return neighbourhood;
}
public int[] getnumbersincol(int col, int[][]board){
for(int z = 0; z<=8; z++){
cols[z]=newboard[z][col];
}
return cols;
}
public boolean isinrow(int number, int col){
for(int x = 0;x<=8;x++){
if(newboard[col][x]==number){
return true;
}
}
return false;
}
public int amountofcellsleft(){
int emptycount = 0;
for(int x = 0; x<=8;x++){
for(int y = 0; y<=8;y++){
if(newboard[x][y]==0){
emptycount++;
}
}
}
return emptycount;
}
public boolean isincol(int number, int row){
for(int x =0;x<=8;x++){
if(newboard[row][x]==number){
return true;
}
}
return false;
}
// Checks if a value is equal to zero
//Takes an array and an int as arguments
public boolean isarrayzero(int array[],int cellinarray){
if(array[cellinarray]==0){
return true;
}
else{
return false;
}
}
}