counterClockwise90 method
Copy this as a counter-clockwise 90 degree rotation.
Implementation
GridWorld counterClockwise90() {
final newCells = List<bool>.filled(_numRows * _numCols, false);
int newIndex(int i, int j) => ((_numCols - 1 - j) * _numRows) + i;
for (var i = 0; i < _numRows; i++) {
for (var j = 0; j < _numCols; j++) {
newCells[newIndex(i, j)] = isAlive(i, j);
}
}
return GridWorld(_numCols, newCells);
}