Esempio n. 1
0
        public bool FindMatchingMaps(MapStatisticModel MapA, string PeriodName, TeamStatisticPeriodModel TeamB)
        {
            bool MapFound = false;

            foreach (var period in TeamB.TeamStatistics)
            {
                // Find matching period
                if (PeriodName == period.Period)
                {
                    // Try to find matching map
                    foreach (var MapB in period.Maps)
                    {
                        if (MapA.Map.ToLower() == MapB.Map.ToLower())
                        {
                            MapFound = true;
                            // If found compare maps
                            MapA.SuggestedMap = CompareStats(MapA, MapB);
                        }
                    }
                    if (MapFound == false)
                    {
                        // Compare with empty map
                        MapA.SuggestedMap = CompareStats(MapA, new MapStatisticModel());
                    }
                }
            }

            return(true);
        }
Esempio n. 2
0
 private double SetWinPercentSpecialCases(MapStatisticModel Map)
 {
     // If extra few matches, set winpercent manually
     if (Map.TotalWins + Map.TotalLosses < 2)
     {
         if (Map.TotalWins + Map.TotalLosses == 0) // 50% if no games
         {
             return(50);
         }
         else if (Map.TotalWins == 1) // 1-0 record 67%
         {
             return(67);
         }
         else // 0-1 record 33%
         {
             return(33);
         }
     }
     else
     {
         return(Map.WinPercent);
     }
 }
Esempio n. 3
0
        private SuggestedMapModel CompareStats(MapStatisticModel MapA, MapStatisticModel MapB)
        {
            SuggestedMapModel result    = null;
            double            TFRPoints = 0.0;

            #region SPECIAL CASES
            // Empty record, default 0.5
            if (MapB.DifficultyRating == 0)
            {
                MapB.DifficultyRating = 0.5;
            }
            var WinPercentA = SetWinPercentSpecialCases(MapA);
            var WinPercentB = SetWinPercentSpecialCases(MapB);
            #endregion

            int WinLossRecord = (MapA.TotalWins - MapA.TotalLosses) - (MapB.TotalWins - MapB.TotalLosses);
            var valuePoint    = Math.Round((WinPercentA - WinPercentB) / 10.0);

            var diffPoint = (int)Math.Floor((MapA.DifficultyRating - MapB.DifficultyRating) * 10);
            TFRPoints = MapA.FullTeamRanking - MapB.FullTeamRanking;

            if (WinLossRecord > 0 && valuePoint > 0 && MapA.WinPercent >= 50)
            {
                result = new SuggestedMapModel();

                result.Map                = MapA.Map;
                result.SuggestedRank      = Math.Ceiling((((WinLossRecord + valuePoint) / 2.0) + diffPoint) * (MapA.FullTeamRanking * 0.2));
                result.WinLossRecord      = WinLossRecord;
                result.WinPercent         = Math.Round(WinPercentA - WinPercentB, 1);
                result.DifficultyRating   = Math.Round((MapA.DifficultyRating - MapB.DifficultyRating) * 10, 1);
                result.TFRating           = Math.Round(TFRPoints, 1);
                result.SuggestiveMapClass = GetClassBySuggestedRank(result.SuggestedRank);
            }

            return(result);
        }