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