Пример #1
0
 public void EvaluateCell(Cell cell)
 {
     if (cell.State == LifeState.Alive)
     {
         var liveCellCount = cell.NeighbouringCells.Count(cellItem => cellItem.State == LifeState.Alive);
         if (liveCellCount > 3)
         {
             cell.CalculatedState = LifeState.Dead;
         }
     }
 }
Пример #2
0
        private void SetupBoard()
        {
            for (int r = 0; r < Rows; r++)
            {
                var cellRow = new CellRow();
                Cells.Add(cellRow);

                for (int c = 0; c < Columns; c++)
                {
                    var cell = new Cell(r, c, Rows, Columns);
                    cellRow.Add(cell);
                }
            }
        }