public class someClass{
public String[][] board = new String[7][7];
public someClass(){
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
board[i][j] = " ";
}
}
}
I have this in a class I am using, I an struggling to find a way to search through the array and see if the cells left, right, above or below of a particular cell are empty or filled.
I.E board[4][2] - how would I look through the array to see if position [4][1], [4][3], [3][2] and [5][2] are empty or have an element inside of them?
EDIT: I have tries to use nested for loops to look through the array and subtract 1 from the indexes in the loop, however that provides nothing.