Пример #1
0
        private void SpawnNewCells(Cell liveCell)
        {
            var neighbors = new List <Cell>();
            var xLocation = liveCell.XLocation;
            var yLocation = liveCell.YLocation;

            liveCell.Neighbors().ToList().ForEach(BirthNewCell);
        }
Пример #2
0
        private int CountAliveNeighbors(Cell cell)
        {
            var count = 0;

            foreach (var neighbor in cell.Neighbors())
            {
                if (_currentLiveGen.ContainsKey(neighbor.ToString()))
                {
                    count++;
                }
            }

            return(count);
        }
Пример #3
0
 public bool NeighborsReturnsTrueWhenCellsAreNextToEachOther(int aX, int aY, int bX, int bY)
 {
     Cell cellA = new Cell(LifeStates.ALIVE, aX, aY);
     Cell cellB = new Cell(LifeStates.ALIVE, bX, bY);
     return cellA.Neighbors(cellB);
 }