public void initializeGame() { cellGrid = new CellGrid(15, 15); generation = 0; initialGameState(); }
public CellGrid(CellGrid copyGrid) { gridWidth = copyGrid.GridWidth; gridHeight = copyGrid.GridHeight; grid = new Cell[gridHeight, gridWidth]; for (int i = 0; i < gridHeight; i++) { for (int j = 0; j < gridWidth; j++) { grid[i, j] = new Cell(copyGrid.grid[i,j]); } } }
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; }