Я пытаюсь создать игру жизни с разными классами, и у меня возникли проблемы.
Я хочу проверить, есть ли живой человек в поле с указательными рядами, col. < /p>
Вот мой код: < /p>
public class LifeBoard {
private int rows;
private int cols;
private int generation;
/**Creates a playing field with rows as rows and cols as columns.
The counter for generations is 1.*/
public LifeBoard(int rows, int cols) {
this.rows = rows;
this.cols = cols;
this.generation = 1;
}
/**Checks if there's a living individual in the box row, col*/
public boolean get(int row, int col) {
if(this.board[row][col] == null){
return false;
} else {
return true;
}
}
}
< /code>
Я не знаю, что делать. Как мне это проверить?
Подробнее здесь: https://stackoverflow.com/questions/281 ... nt-classes