Exemple #1
0
 private int NumberOfAliveNeighbours(Coordinate coordinate) =>
 GetNeighboursInWorld(coordinate)
 .Count(IsAlive);
Exemple #2
0
 private Location[] GetNeighboursInWorld(Coordinate coordinate) =>
 Locations.Where(l => coordinate.Neighbours()
                 .Select(c => c.WrapCoordinate(Size))
                 .Where(c => !c.Equals(coordinate))
                 .Contains(l.Coordinate))
 .ToArray();