Example #1
0
 public EgbCsglPair(EGBMatch egbm, CSGLMatch csglm)
 {
     this.egbm = egbm;
     this.csglm = csglm;
     oddsAdiff = egbm.coefB / (egbm.coefA + egbm.coefB) - csglm.oddsA;
     oddsBdiff = egbm.coefA / (egbm.coefA + egbm.coefB) - csglm.oddsB;
 }
Example #2
0
 public EGBMatch(EGBMatch m)
 {
     matchId = m.matchId;
     teamB = m.teamB;
     teamA = m.teamA;
     coefA = m.coefA;
     coefB = m.coefB;
     oddsA = m.oddsA;
     oddsB = m.oddsB;
     date = m.date;
     winner = m.winner;
 }
Example #3
0
 private static bool ClosedMatch(EGBMatch M)
 {
     return M.winner == "c";
 }
Example #4
0
        private int GetPairs()
        {
            if (!drawCSGL.Enabled || !drawEGB.Enabled)
                return 0;
            pairs.Clear();

            foreach (CSGLMatch csglm in MatchesCSGL)
            {
                if ((Convert.ToDouble(csglmaxodds.Text, CultureInfo.InvariantCulture) < csglm.oddsA) ||
                           (Convert.ToDouble(csglminodds.Text, CultureInfo.InvariantCulture) > csglm.oddsA) ||
                           (Convert.ToInt32(maxmatchid.Text) < csglm.matchId) ||
                           (Convert.ToInt32(minmatchid.Text) > csglm.matchId) ||
                           (!bo1.Checked && csglm.format == "1") ||
                           (!bo2.Checked && csglm.format == "2") ||
                           (!bo3.Checked && csglm.format == "3") ||
                           (!bo5.Checked && csglm.format == "5"))
                    continue;

                List<EGBMatch> clones = new List<EGBMatch>();
                List<double> LDist = new List<double>();
                foreach (EGBMatch egbm in MatchesEGB)
                {
                    TimeSpan ts = egbm.full_date - csglm.full_date;
                    if (ts.Days == 0 && Math.Abs(ts.TotalHours) <= 3)
                    {
                        double Score = 0;
                        egbm.FixTeamNames();
                        csglm.FixTeamNames();
                        int AA = LevenshteinDistance.Compute(egbm.teamA, csglm.teamA);
                        int BB = LevenshteinDistance.Compute(egbm.teamB, csglm.teamB);
                        int AB = LevenshteinDistance.Compute(egbm.teamA, csglm.teamB);
                        int BA = LevenshteinDistance.Compute(egbm.teamB, csglm.teamA);
                        bool passed = true;
                        double leniency = 1.2;
                        EGBMatch copy = new EGBMatch(egbm);
                        if (AA + BB > AB + BA)
                        {
                            if (AB * leniency > egbm.teamA.Length || AB * leniency > csglm.teamB.Length)
                                passed = false;
                            if (BA * leniency > egbm.teamB.Length || BA * leniency > csglm.teamA.Length)
                                passed = false;
                            copy.SwapTeams();
                        }
                        else
                        {
                            if (AA * leniency > egbm.teamA.Length || AA * leniency > csglm.teamA.Length)
                                passed = false;
                            if (BB * leniency > egbm.teamB.Length || BB * leniency > csglm.teamB.Length)
                                passed = false;
                        }
                        if (passed)
                        {
                            Score += Math.Min(AA + BB, AB + BA);
                            Score += ts.TotalHours * 3;
                            Score += 80 * Math.Abs(copy.coefB / (copy.coefA + copy.coefB) - csglm.oddsA);
                            clones.Add(copy);
                            LDist.Add(Score);
                        }
                    }
                }
                if (LDist.Count > 0)
                {
                    EGBMatch egbm1 = clones[LDist.IndexOf(LDist.Min())];
                    pairs.Add(new EgbCsglPair(egbm1, csglm));
                }
            }
            return pairs.Count;
        }
Example #5
0
        /////////////////////
        // EGAMINGBETS.COM //
        // EGAMINGBETS.COM //
        // EGAMINGBETS.COM //
        // EGAMINGBETS.COM //
        // EGAMINGBETS.COM //
        /////////////////////
        private void getEGBbtn_Click(object sender, EventArgs e)
        {
            // mid = Match ID
            int mid_from = Convert.ToInt32(egb_mid_fromBox.Text);
            int mid_to = Convert.ToInt32(egb_mid_toBox.Text);

            MatchesEGB = new List<EGBMatch>();
            List<int> dateerr = new List<int>();

            if (EGBautosave.Checked)
                saveFileDialog.ShowDialog();

            for (int mid = mid_from; mid <= mid_to; mid++)
            {
                this.Invalidate(true);
                if (F.ActiveForm != null)
                    F.ActiveForm.Text = "Matches checked: " + mid.ToString() + "; Matches recorded:" + MatchesEGB.Count.ToString();
                if (EGBautosave.Checked && MatchesEGB.Count % 10 == 0)
                    Json.WriteToJsonFile<List<EGBMatch>>(saveFileDialog.FileName, MatchesEGB);
                try
                {
                    EGBMatch current = new EGBMatch();
                    current.GetMatch(mid);
                    MatchesEGB.Add(current);
                    if (EGBautodraw.Checked)
                    {
                        int odds;
                        if (current.winner == "a")
                        {
                            odds = (int)Math.Round(100 * current.coefA / (current.coefA + current.coefB));
                            WinsCount[odds]++;
                            MatchesCount[odds]++;
                            MatchesCount[100 - odds]++;
                        }
                        else if (current.winner == "b")
                        {
                            odds = (int)Math.Round(100 * current.coefB / (current.coefA + current.coefB));
                            WinsCount[odds]++;
                            MatchesCount[odds]++;
                            MatchesCount[100 - odds]++;
                        }
                        DrawGraph("EGB");
                    }
                }
                catch (Exception err)
                {
                    if (err.Message == "Date parsing error")
                        dateerr.Add(mid);
                }
            }
            MatchesEGB.RemoveAll(ClosedMatch); // remove closed matches; winner = c
            ActivateEGB();
        }