示例#1
0
        public List<Limitation> ShowAllMatchesForSpecificCombination(Limitation combination)
        {
            // We need raw combintations so let's ensure that the system is
            // developed without any compression

            CountCombinations();

            var matchingCombination = new List<Limitation>();

            combination.MaxMatches = combination.CountSkippingZeros();
            combination.MinMatches = combination.CountSkippingZeros();

            foreach (Limitation systemCombination in _developedSystem)
            {
                if (combination.IsMatching(systemCombination))
                {
                    matchingCombination.Add(systemCombination);
                }
            }

            return matchingCombination;
        }
示例#2
0
        // Used to retrive the winning ticket's index, if any, for a specific
        // combination.  If the system does not contain a winning ticket
        // returns -1
        public int GetWinningTicket(Limitation combination)
        {
            // We need the number of the winning ticket, so let's ensure
            // that the system is already compressed

            Develop();

            int m = 0;

            combination.MaxMatches = combination.Count();
            combination.MinMatches = combination.Count();

            int index = -1;
            foreach (Limitation systemCombination in _developedSystem)
            {
                ++index;

                if (combination.IsMatching(systemCombination))
                {
                    return index + 1;
                }
            }

            return m;
        }