private Node GetNodeForCA(Node node, NeighbourhoodEnum type) { switch (type) { case NeighbourhoodEnum.Moore: case NeighbourhoodEnum.VonNeumann: return(GetNodeforStandardMethod(node)); case NeighbourhoodEnum.Moore2: return(GetNodeforModificationMethod(node)); } return(null); }
public List <Node> GetNeighbourhoods(int x, int y, NeighbourhoodEnum type, bool isFromCurrent = false) { switch (type) { case NeighbourhoodEnum.Moore: return(GetMooreNeighbourhoods(x, y, isFromCurrent)); case NeighbourhoodEnum.VonNeumann: return(GetVonNeumannNeighbourhoods(x, y, isFromCurrent)); case NeighbourhoodEnum.Cross: return(GetCrossNeighbourhoods(x, y, isFromCurrent)); } return(new List <Node>()); }
private List <KeyValuePair <Node, int> > GetListOfGrainNeighbourhood(Node node, NeighbourhoodEnum type) { var neighbourhood = _simulationEngine.MapController.GetNeighbourhoods(node.X, node.Y, type); neighbourhood = neighbourhood.Where(k => k.Type == TypeEnum.Grain).ToList(); if (neighbourhood.Any()) { var orderedNeighbourhood = neighbourhood.GroupBy(s => s).Select(g => new KeyValuePair <Node, int>(g.First(), g.Count())).OrderByDescending(p => p.Value).ToList(); return(orderedNeighbourhood); } return(null); }