Пример #1
0
        List<Possibility> FindPossibilitiesForMultiplyCage(int dimension)
        {
            List<Possibility> possibilities = new List<Possibility>();

            List<int> primeFactors = Helper.PrimeFactors(TargetValue);
            primeFactors.Add(1);

            MultiSet multisetOfPrimes = new MultiSet(primeFactors);

            IEnumerable<Partition> partitions = multisetOfPrimes.Partition().Filter(CellCount, dimension);

            foreach (var partion in partitions)
            {
                Possibility newPossibility = new Possibility(partion);

                if (newPossibility.MaxRepeatCount <= this.RepeatCount
                            && !possibilities.Contains(newPossibility, new SequenceComparer<Possibility>()))
                    possibilities.Add(newPossibility);
            }

            return possibilities;
        }