コード例 #1
0
ファイル: BestFigures.cs プロジェクト: jpazarzis/hogar
        private bool TopBrisRating(BrisRace race, BrisHorse horse, Horse myhorse)
        {
            if (myhorse.Scratched || horse.IsFirstTimeOut || horse.BestRating <= 0)
            {
                return false;
            }

            List<BrisHorse> list = new List<BrisHorse>();

            foreach (BrisHorse brisHorse in race.Horses)
            {
                Horse h = myhorse.Parent.GetHorseByProgramNumber(brisHorse.ProgramNumber);

                if ((null != h) && (!h.Scratched) && (brisHorse.BestRating > 0))
                {
                    list.Add(brisHorse);
                }
            }

            list.Sort(CompareBestRating);

            if (list.Count <= 2)
            {
                return false;
            }
            else
            {
                return list[0] == horse;
            }
        }
コード例 #2
0
ファイル: BrisHorse.cs プロジェクト: jpazarzis/hogar
        internal BrisHorse(ParsableText pt)
        {
            _parent = null;
            _parsableText = pt;

            string s;
            s = _parsableText.Tokens[FieldIndex.NUMBER_OF_DAYS_SINCE_LAST_RACE_FOR_TODAYS_RACE].ToString().Trim();
            _daysSinceLastRace = s.Length > 0 ? Convert.ToInt32(s) : 0;

            s = _parsableText.Tokens[FieldIndex.CLAIMING_PRICE_OF_HORSE].ToString().Trim();
            _claimingPriceOfTheHorseAsDouble = s.Length > 0 ? Convert.ToDouble(s) : 0.0;

            s = _parsableText.Tokens[FieldIndex.CLAIMING_PRICE_OF_RACE].ToString().Trim();
            _claimingPriceOfTheRaceAsDouble = s.Length > 0 ? Convert.ToDouble(s) : 0.0;

            _brisLateAvg = CalcBrisLateAvg();
            _brisCompositeLastThree = CalcBrisCompositeLastThree();
            _bestRating = CalcBestRating();
            _medication = GetMedication();
            _isFirstTimeLasix = Medication.Trim().CompareTo("FL") == 0;
            _brisRunStyle = _parsableText.Tokens[FieldIndex.BRIS_RUN_STYLE].ToString();
            _quirinSpeedPoints = CalcQuirinSpeedPoints();
            _primePowerRating = CalcPrimePowerRating();
            if (_parsableText.Tokens[FieldIndex.EQUIPMENT_CHANGE].Length > 0)
            {
                _equipment = Convert.ToInt32(_parsableText.Tokens[FieldIndex.EQUIPMENT_CHANGE].ToString());
            }
            _currentYearEarnings = GetCurrentYearEarnings();
            _todaysTrackEarnings = GetTodaysTrackEarnings();

            if (_parsableText.Tokens[FieldIndex.WEIGHT].Length > 0)
            {
                _weight = Convert.ToInt32(_parsableText.Tokens[FieldIndex.WEIGHT].ToString());
            }
            _todaysRaceIsARoute = GetTodaysRaceIsARoute();
            _todaysRaceIsInTurf = GetTodaysRaceIsInTurf();
            _isSynthetic = GetTodaysRaceIsSynthetic();
            _age = GetAge();

            string postTimeStr = _parsableText.Tokens[FieldIndex.POST_TIME].ToString();

            _postTime = ConvertPacificMilitaryTimeToEastern(_parsableText.Tokens[FieldIndex.POST_TIME].ToString());
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
ファイル: Race.cs プロジェクト: jpazarzis/hogar
 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);
         }
     }
 }
コード例 #5
0
ファイル: Race.cs プロジェクト: jpazarzis/hogar
 public static Race MakeRaceFromBrisRace(BrisRace brisRace)
 {
     Race r = new Race(brisRace.RaceNumber);
     r.LoadFromBrisRace(brisRace);
     return r;
 }
コード例 #6
0
ファイル: Race.cs プロジェクト: jpazarzis/hogar
 private void LoadFromBrisRace(BrisRace brisRace)
 {
     for (int i = 0; i < brisRace.NumberOfHorses; ++i)
     {
         Horse h = new Horse(brisRace[i].ProgramNumber, brisRace[i].Name, brisRace[i].MorningLineOdds);
         _horse.Add(h);
     }
     InitializeHorses(brisRace);
 }