Ejemplo n.º 1
0
        public void initializeGame()
        {
            cellGrid = new CellGrid(15, 15);
            generation = 0;

            initialGameState();
        }
Ejemplo n.º 2
0
        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]);
                }
            }
        }
Ejemplo n.º 3
0
        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;
        }