Esempio n. 1
0
 public bool IsNearMe(Cell otherCell)
 {
     var otherLoc = otherCell._location;
     return otherLoc.X >= _location.X - 1 && otherLoc.X <= _location.X + 1
            && otherLoc.Y >= _location.Y - 1 && otherLoc.Y <= _location.Y + 1
            && otherLoc != _location;
 }
Esempio n. 2
0
        private void SetAlive(IEnumerable<PointULong> alive)
        {
            //set alive cells
            foreach (var item in alive)
            {
                _aliveCells[item] = new Cell(item);
            }

            //locate all cells around alive
            foreach (var i in _aliveCells.Values)
            {
                foreach (var j in i.AroundCellsCoords)
                {
                    if (!_aliveCells.ContainsKey(j))
                        _aroundAliveCells[j] = new Cell(j);
                }
            }
        }