public static double Make(RaceInfo raceInfo, CynthiaPar cp ,CallOfTheRace callOfTheRace, double weight, double beatenLengths) { double distanceInFeet =0.0; double cynthiaPar = 0.0; double timeForTheCall = 0.0; switch (callOfTheRace) { case CallOfTheRace.First: distanceInFeet = raceInfo.FirstCallInFeet; timeForTheCall = raceInfo.FirstCall; cynthiaPar = cp.FirstCall; break; case CallOfTheRace.Second: distanceInFeet = raceInfo.SecondCallInFeet; timeForTheCall = raceInfo.SecondCall; cynthiaPar = cp.MidCall; break; case CallOfTheRace.Final: distanceInFeet = raceInfo.DistanceOfTheRaceInFeet; timeForTheCall = raceInfo.FinalTime; cynthiaPar = cp.FinalCall; break; } double d = distanceInFeet; double t = timeForTheCall; double w = weight; double dt = (120.0 - w) * 0.035; double unadjustedFigure = (distanceInFeet / cynthiaPar) - (distanceInFeet - beatenLengths * 10.0) / (t + dt); return unadjustedFigure + Adjustment(raceInfo, callOfTheRace); }
public void BindRaceInfo(RaceInfo ri) { _txtboxClass.Text = ri.EQBRaceType; _txtboxDistance.Text = ri.DistanceOfTheRaceInYards.ToString(); _txtboxFinalTime.Text = ri.FinalTime.ToString(); _txtboxFirstCall.Text = ri.FirstCall.ToString(); _txtboxSecondCall.Text = ri.SecondCall.ToString(); _txtboxInnerOrOuter.Text = (ri.WasRanInInnerTrack ? "Inner" : "Outer") + " " + (ri.WasRanInTheTurf ? "Turf" : "Dirt"); _txtboxMaxClaimingPrice.Text = string.Format("{0:0}", ri.MaxClaimingPrice); }
private static double Adjustment(RaceInfo ri, CallOfTheRace callOfTheRace) { double adj = 0.0; if (ri.IsStateBred && callOfTheRace == CallOfTheRace.Final) { adj += -0.2; } if (ri.IsThreeYearsOnly) { switch (callOfTheRace) { case CallOfTheRace.First: adj += ThreeYearOldAdjusment(ri.Month, ri.Day, callOfTheRace); break; case CallOfTheRace.Second: adj += ThreeYearOldAdjusment(ri.Month, ri.Day, callOfTheRace); break; case CallOfTheRace.Final: adj += ThreeYearOldAdjusment(ri.Month, ri.Day, callOfTheRace); break; } } else if (ri.IsTwoYearsOnly) { return 0.0; } if (ri.IsFemaleOnly) { switch (callOfTheRace) { case CallOfTheRace.First: adj += -0.14; break; case CallOfTheRace.Second: adj += -0.22; break; case CallOfTheRace.Final: adj += -0.45; break; } } return adj; }
public void BindRaceInfo(RaceInfo ri, List<HorseInfo> horseInfo) { _ri = ri; _horseInfo = horseInfo; CynthiaPar cp = CynthiaPar.Make(ri.TrackCode, ri.Year, ri.Month, ri.Day,ri.RaceNumber); _txtboxClass.Text = cp.CynthiaClassification; _txtboxFirstCall.Text = cp.FirstCall.ToString(); _txtboxSecondCall.Text = cp.MidCall.ToString(); _txtboxFinalTime.Text = cp.FinalCall.ToString(); double firstCallWSP = WillardSpeedFigure.Make(ri, cp, WillardSpeedFigure.CallOfTheRace.First, 120.0,0.0); double secondCallWSP = WillardSpeedFigure.Make(ri, cp, WillardSpeedFigure.CallOfTheRace.Second, 120.0,0.0); double finalCallWSP = WillardSpeedFigure.Make(ri, cp, WillardSpeedFigure.CallOfTheRace.Final, 120.0,0.0); _txtboxSpeedForFisrtCall.Text = (ri.FirstCallInFeet / cp.FirstCall).ToString(); _txtboxSpeedForSecondCall.Text = (ri.SecondCallInFeet / cp.MidCall).ToString(); _txtboxSpeedForFinalCall.Text = (ri.DistanceOfTheRaceInFeet / cp.FinalCall).ToString(); _txtboxFirstCallWSF.Text = firstCallWSP.ToString(); _txtboxSecondCallWSF.Text = secondCallWSP.ToString(); _txtboxFinalCallWSF.Text = finalCallWSP.ToString(); foreach (HorseInfo hf in horseInfo) { hf.CalculateWSF(ri); } _grid.Columns.Clear(); _grid.Columns.Add("Name", "Name"); _grid.Columns.Add("1stCall", "1stCall"); _grid.Columns.Add("2ndCall", "2ndCall"); _grid.Columns.Add("FinalCall", "FinalCall"); LoadGrid(horseInfo); }
public void CalculateWSF(RaceInfo ri) { CynthiaPar cp = CynthiaPar.Make(ri.TrackCode, ri.Year, ri.Month, ri.Day, ri.RaceNumber); _firstCallWSF = WillardSpeedFigure.Make(ri, cp, WillardSpeedFigure.CallOfTheRace.First, _weight,_firstCallLengthsBehind); _secondCallWSF = WillardSpeedFigure.Make(ri, cp, WillardSpeedFigure.CallOfTheRace.Second, _weight,_secondCallLengthsBehind); _finalCallWSF = WillardSpeedFigure.Make(ri, cp, WillardSpeedFigure.CallOfTheRace.Final, _weight,_finalCallLengthsBehind); }