private static int CountLiveNeighboursOf(ICellLocation cellLocation, ISet<ICellLocation> liveNeighbours) { // The LINQ equivalent of this code performs slightly worse: // return cellLocation.Neighbours().Count(neighbour => liveNeighbours.Contains(neighbour)); var count = 0; foreach (var neighbour in cellLocation.Neighbours()) if (liveNeighbours.Contains(neighbour)) count++; return count; }
public void SetFakeNeighbours(ICellLocation[] value) { _fakeNeighbours = value; }