private void ProcessRace(Race race, int constant, BrisRace brisRace,string filename)
        {
            UpdateObserver(string.Format("Processing race {0} with constant = {1} {2}", race.RaceNumber,constant,filename));
            List<double> figure = new List<double>();
            Dictionary<string, int> horseIndex = new Dictionary<string, int>();

            int index = 0;
            foreach (Horse horse in race.Horses)
            {
                if (!horse.Scratched)
                {
                    if (horse.ProgramNumber.Trim().Length == 0)
                    {
                        continue;
                    }
                    BrisHorse brisHorse = brisRace.GetHorseFromItsNumber(horse.ProgramNumber);

                    if (null != GetValue)
                    {
                        figure.Add(GetValue(brisHorse));
                        horseIndex.Add(brisHorse.ProgramNumber.Trim(), index);
                        ++index;
                    }
                }
            }

            FiguresToProbabilities fp = new FiguresToProbabilities();

            figure = fp.Calculate(figure, constant);

            string programNumber = GetWinnerForRace(race.Parent.BrisAbrvTrackCode, race.Parent.Date, race.RaceNumber).Trim();

            if (horseIndex.ContainsKey(programNumber))
            {
                int i = horseIndex[programNumber];

                double winnersFigure = figure[i];

                if (!_winnerPercentage.ContainsKey(constant))
                {
                    _winnerPercentage.Add(constant, new List<double>());
                }

                _winnerPercentage[constant].Add(winnersFigure);
            }
        }
Example #2
0
 internal void InitializeHorses(BrisRace brisRace)
 {
     _correspondingBrisRace = brisRace;
     brisRace.CorrespondingRace = this;
     foreach (Horse horse in _horse)
     {
         if (null != horse)
         {
             horse.Parent = this;
             horse.CorrespondingBrisHorse = brisRace.GetHorseFromItsNumber(horse.ProgramNumber);
         }
     }
 }