Well I made myself a nice MultiDimensional array:
And I need to somehow scan through that board going from left to right, starting at the right side in the next row , printing out the array location of o's in the multidimensional array. This isn't homework, here's what I tried to do, it only prints out the 0's in the first row.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}};
So for the first 0 on the top left in the newboard[][], I need it to return
X = 0;
Y = 0;
Here's what I tried, I'm not quite sure how to get it to read more than the first row;
public void emptycellsearch(){ int y = 0; int x = 0; for(x = 0;x<=8;x++){ for(y = 0;y<=8;y++){ if(x==0 && newboard[x][y]==0){ System.out.println("X value is "); System.out.println(x); System.out.println("Y value is "); System.out.println(y); } } } }