private void CheckIsSellWillBorn(int rowIndex, int colIndex, Generation generation) { int neighborsCount = GetNeighbornsCount(rowIndex, colIndex); if (neighborsCount == 3) { generation.ChangeCellData(rowIndex, colIndex, true); generation.ChangeCellData(rowIndex, colIndex, Color.red); } }
private void CheckIsCellWillBeLive(int rowIndex, int colIndex, Generation generation) { int neighborsCount = GetNeighbornsCount(rowIndex, colIndex); if (neighborsCount < 2 || neighborsCount > 3) { generation.ChangeCellData(rowIndex, colIndex, false); } else { generation.ChangeCellData(rowIndex, colIndex, true); } }
public void CreateFirstGeneration() { Generation newGeneration = new Generation(controller.RowsCount, controller.ColCount); for (int i = 0; i < controller.RowsCount; i++) { for (int j = 0; j < controller.ColCount; j++) { if (Random.Range(0, 2) == 1) { //newGeneration.ChangeCellData(i,j,true); newGeneration.ChangeCellData(i, j, Color.red); } } } controller.SetCurrentGenerationData(newGeneration); }