aliveAtNextStep method
Returns true if the GridWorld cell at {i,j} should be alive after the next time step.
Implementation
@override
bool aliveAtNextStep(GridWorld w, int i, int j) {
_w = w;
final count = _neighborCountUpToFour(i, j);
if (_w.isAlive(i, j)) {
// It's alive, but will only stay alive if
// exactly 2 or 3 neighbors are alive (i.e.,
// the cell has some living friends, but not
// so many that there's overpopulation).
return count == 2 || count == 3;
}
// The cell is dead, but bring it to life if there
// are exactly three neighbors.
return count == 3;
}