public void updateGrid() { CellGrid newGrid = new CellGrid(cellGrid.GridWidth, cellGrid.GridHeight); for (int i = 0; i < cellGrid.GridHeight; i++) { for (int j = 0; j < cellGrid.GridWidth; j++) { newGrid.setCellsState(i, j, nextCellState(i,j)); } } cellGrid = new CellGrid(newGrid); Generation = Generation + 1; }