public void Merge(IndexedPointHash right)
        {
            for (int i = 0; i < arraySize; i++)
            {
                if (right.slotValues[i] != 0)
                {
                    slotValues[i] = right.slotValues[i];
                    indexedSlot.Add(i);
                }

            }
        }
示例#2
0
        public IndexedPointHash GetLargestZone()
        {
            List<int> indexes = new List<int>();
            int index = 0;
            for (int i = 0; i < zones.Count; i++)
            {
                if (zones[index].Count < zones[i].Count)
                {
                    index = i;
                    indexes.Clear();
                    indexes.Add(i);
                }
                else if (zones[index].Count == zones[i].Count)
                {
                    indexes.Add(i);
                }
            }

            IndexedPointHash result = null;
            if (zones.Count > 0)
            {
                if (indexes.Count == 1)
                    result = zones[index];
                else
                {
                    result = new IndexedPointHash();
                    foreach (int i in indexes)
                    {
                        result.Merge(zones[i]);
                    }
                }

                foreach (Point p in ArticulationPoints)
                {
                    foreach (Point p1 in Utility.GetValidMoves(p, board))
                    {
                        if (result.Contains(p1) && !result.Contains(p))
                        {
                            result.Add(p, 1);
                        }
                    }
                }
            }

            return result;
        }