public Dictionary <int, PatternNeighbours> FIndNeighbours(PatternDataResults patterndataResults)
        {
            Dictionary <int, PatternNeighbours> result = new Dictionary <int, PatternNeighbours>();

            FindNeighboursForEachPattern(patterndataResults, result);
            return(result);
        }
 private static void FindNeighboursForEachPattern(PatternDataResults patterndataResults, Dictionary <int, PatternNeighbours> result)
 {
     for (int y = 0; y < patterndataResults.GetGridLengthInY(); y++)
     {
         for (int x = 0; x < patterndataResults.GetGridLengthInX(); x++)
         {
             PatternNeighbours neighbours = PatternFinder.CheckNeighboursInEachDirection(x, y, patterndataResults);
             PatternFinder.AddNeighboursToDictionary(result, patterndataResults.GetIndexAt(x, y), neighbours);
         }
     }
 }
        public Dictionary <int, PatternNeighbours> FIndNeighbours(PatternDataResults patterndataResults)
        {
            Dictionary <int, PatternNeighbours> patternDictionary = new Dictionary <int, PatternNeighbours>();

            foreach (var patternDataToCheck in patterndataResults.PatternIndexDictionary)
            {
                foreach (var possibleNeighbourPatternData in patterndataResults.PatternIndexDictionary)
                {
                    FindNeighboursInAllDirections(patternDictionary, patternDataToCheck, possibleNeighbourPatternData);
                }
            }
            return(patternDictionary);
        }
Пример #4
0
        public static PatternNeighbours CheckNeighboursInEachDirection(int x, int y, PatternDataResults patterndataResults)
        {
            PatternNeighbours neighbours = new PatternNeighbours();

            foreach (Direction dir in Enum.GetValues(typeof(Direction)))
            {
                int possiblePatternIndex = patterndataResults.GetNeighbourInDirection(x, y, dir);
                if (possiblePatternIndex >= 0)
                {
                    neighbours.AddPatternToDirection(dir, possiblePatternIndex);
                }
            }
            return(neighbours);
        }
Пример #5
0
 public static Dictionary <int, PatternNeighbours> FindPossibleNeighbursForAllPatterns(IFindNeighboutStrategy patternFinder, PatternDataResults patterndataResults)
 {
     return(patternFinder.FIndNeighbours(patterndataResults));
 }
Пример #6
0
 private void GetPatternNeighbours(PatternDataResults patternFinderResults, IFindNeighboutStrategy startegy)
 {
     patternPossibleNeighboursDictionary = PatternFinder.FindPossibleNeighbursForAllPatterns(startegy, patternFinderResults);
 }