List <Point> GetInclusionStartPointsOnBoundaries(Grid grid, int amount, Neighbourhood.Neighbourhood neighbourhood, BoundaryCondition boundaryCondition) { List <Point> inclusionsStartingPoints = new List <Point>(); List <Point> neighbourhoodPoints = new List <Point>(); for (int x = 0; x < Grid.SizeX; x++) { for (int y = 0; y < Grid.SizeY; y++) { neighbourhoodPoints = neighbourhood.GetNeighborhood(x, y, Grid.SizeX, Grid.SizeY, boundaryCondition); if (neighbourhoodPoints.Any(p => (grid.Cells[p.X, p.Y].Id != grid.Cells[x, y].Id || grid.Cells[p.X, p.Y].State == 0) && grid.Cells[x, y].Id != 2 ) ) { inclusionsStartingPoints.Add(new Point(x, y)); } } } Shuffle(inclusionsStartingPoints); return(inclusionsStartingPoints.Take(amount).ToList()); }
public bool GenerateInclusions(ref Grid grid, int amount, int value, Neighbourhood.Neighbourhood neighbourhood, BoundaryCondition boundaryCondition) { ChangeGridCellsToInclusion(ref grid, amount, value, GetInclusionStartPointsOnBoundaries(grid, amount, neighbourhood, boundaryCondition)); return(true); }