public PatternGenerator(int rows, int columns)
 {
     this.rows = rows;
     this.columns = columns;
     currentGeneration = new Cell[rows, columns];
     nextGeneration = new Cell[rows, columns];
     for (int row = 0; row < rows; row++)
     {
         for (int col = 0; col < columns; col++)
         {
             currentGeneration[row, col] = new Cell();
             nextGeneration[row, col] = new Cell();
         }
     }
 }
예제 #2
0
 private void CreateCellsState()
 {
     cells = new Cell[NUMROWS, NUMCOLS];
     newCells = new Cell[NUMROWS, NUMCOLS];
     for (int row = 0; row < NUMROWS; row++)
     {
         for (int col = 0; col < NUMCOLS; col++)
         {
             //<Summary>
             //Create instances of Cell class & put them in array
             //Resulting Array > cells[i,j].State = 0
             //cells for storing Automa and 
             //newCells for building new line when rule is applied
             //Note -> required to work out the changes to all cells
             //at once before changing them
             //</>Summary
             cells[row, col] = new Cell();
             newCells[row, col] = new Cell();
         }
     }
 }