Beispiel #1
0
 public int GetTotalValue(Limitation limitation)
 {
     if (null == SelectedRaceCard || null == limitation)
         return 0;
     int fromRace = limitation.FirstRace;
     int toRace = fromRace + limitation.Count() - 1;
     int valueTotal = 0;
     for (int rn = fromRace, i = 0; rn <= toRace; ++rn, ++i)
     {
         var race = SelectedRaceCard.GetRace(rn);
         if (null != race)
         {
             var horse = race.GetHorse(limitation.Selections[i]);
             if (null != horse)
             {
                 valueTotal += horse.ValueIndex;
             }
         }
     }
     return valueTotal;
 }
Beispiel #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;
        }
Beispiel #3
0
        public bool IsMatching(Limitation other)
        {
            if (this.Count() != other.Count())
            {
                return false;
            }

            int count = 0;

            for (int i = 0; i < Count(); ++i)
            {
                if (((RaceSelection)_selection[i]).IsMatching(other.GetRaceSelection(i)))
                {
                    ++count;
                }
            }

            return count >= _minMatches && count <= _maxMatches;
        }