Ejemplo n.º 1
0
        private void ProcessDivision()
        {
            int lastMatchDay = GetLastMatchDay();
            ClassificationTable globalClassification = new ClassificationTable(CurrentSeason, CurrentDivision, 1, lastMatchDay, lastMatchDay);

            globalClassification.GenerateClassificationTable();
            int startingMatchDay = 11;

            //TODO: Parametrizar la jornada inicial a partir del número de "miniligas". P. ej. si tengo una miniliga de 10 hacia atrás, debo empezar enl a jornada 11.
            foreach (int matchDay in Enumerable.Range(startingMatchDay, lastMatchDay - startingMatchDay + 1))
            {
                int start3 = Math.Max(matchDay - 3, 1);
                ClassificationTable minileague3 = new ClassificationTable(CurrentSeason, CurrentDivision, start3, 3, lastMatchDay);
                minileague3.GenerateClassificationTable();

                int start5 = Math.Max(matchDay - 5, 1);
                ClassificationTable minileague5 = new ClassificationTable(CurrentSeason, CurrentDivision, start5, 5, lastMatchDay);
                minileague5.GenerateClassificationTable();

                int start10 = Math.Max(matchDay - 10, 1);
                ClassificationTable minileague10 = new ClassificationTable(CurrentSeason, CurrentDivision, start10, 10, lastMatchDay);
                minileague10.GenerateClassificationTable();

                IEnumerable <Match> matches = Utils.GetMatches(CurrentSeason, CurrentDivision, matchDay);
                foreach (Match match in matches)
                {
                    ProcessMatch(match, globalClassification, minileague3, minileague5, minileague10);
                }
            }
        }
Ejemplo n.º 2
0
        private void ProcessMatch(Match match, ClassificationTable globalClassification, ClassificationTable minileague3, ClassificationTable minileague5, ClassificationTable minileague10)
        {
            Console.WriteLine(match.MatchDay);
            string            homeTeamName = match.HomeTeam.Name;
            string            awayteamName = match.AwayTeam.Name;
            string            result       = (match.HomeTeamGoals > match.AwayTeamGoals) ? HOME_WIN : (match.HomeTeamGoals < match.AwayTeamGoals) ? AWAY_WIN : TIE;
            var               gh           = globalClassification.History.Where(h => h.MatchDay == match.MatchDay - 1 && h.GlobalAccumulator.Team.Name.Equals(homeTeamName)).Single();
            var               l3h          = minileague3.History.Where(h => h.MatchDay == match.MatchDay - 1 && h.GlobalAccumulator.Team.Name.Equals(homeTeamName)).Single();
            var               l5h          = minileague5.History.Where(h => h.MatchDay == match.MatchDay - 1 && h.GlobalAccumulator.Team.Name.Equals(homeTeamName)).Single();
            var               l10h         = minileague10.History.Where(h => h.MatchDay == match.MatchDay - 1 && h.GlobalAccumulator.Team.Name.Equals(homeTeamName)).Single();
            var               ga           = globalClassification.History.Where(h => h.MatchDay == match.MatchDay - 1 && h.GlobalAccumulator.Team.Name.Equals(awayteamName)).Single();
            var               l3a          = minileague3.History.Where(h => h.MatchDay == match.MatchDay - 1 && h.GlobalAccumulator.Team.Name.Equals(awayteamName)).Single();
            var               l5a          = minileague5.History.Where(h => h.MatchDay == match.MatchDay - 1 && h.GlobalAccumulator.Team.Name.Equals(awayteamName)).Single();
            var               l10a         = minileague10.History.Where(h => h.MatchDay == match.MatchDay - 1 && h.GlobalAccumulator.Team.Name.Equals(awayteamName)).Single();
            FeatureMatrixItem x            = new FeatureMatrixItem(CurrentSeason, CurrentDivision, gh, l3h, l5h, l10h, ga, l3a, l5a, l10a, result);

            FeatureMatrix.Add(x);
        }