public Cell(int x, int y, bool isAlive, Cell[,] cells) { IsAlive = isAlive; _point = new Point(x, y); _cells = cells; _log = ""; _aliveNextGen = null; }
public Cell Clone() { Cell cell = new Cell(); cell.IsAlive = IsAlive; cell.Point = Point; cell._aliveNextGen = _aliveNextGen; cell._cells = _cells; return cell; }
public override void Setup(int spawnChanceAtStart, int gridSize) { _spawnChanceAtStart = spawnChanceAtStart; _arraySize = gridSize; _cells = new Cell[_arraySize, _arraySize]; // Populate for (int x = 0; x < _arraySize; x++) { for (int y = 0; y < _arraySize; y++) { bool active = _random.Next(1, 100) <= _spawnChanceAtStart; Cell cell = new Cell(x, y, active, _cells); _cells[x, y] = cell; } } System.GC.KeepAlive(_cells); }