Exemplo n.º 1
0
        static void Main(string[] args)

        {
            //Full test
            double newRanking;
            double currentRanking = 1234;
            double provisionalRanking;
            string pathTokey = @"C:\Users\andreea.rentea\Documents\Visual Studio 2015\Projects\ELORating\key.txt";

            ELOClient client  = new ELOClient();
            string    tierout = client.readSeedData("TossThoseDigits2");                                            //given a summoner name, read from seed data

            DataPlayer datagame = new DataPlayer(1149, 1150, 1499, 1500, 1849, 1850, 2199, 2200, 2499, 2500, 2999); //limits for ranking

            if (tierout == null || tierout.ToLower() == "unranked")
            {
                provisionalRanking = client.calculateProvisionalElo("TossThoseDigits2", 0, datagame);
                currentRanking     = provisionalRanking;
            }

            //create teams
            Hashtable htAllies = new Hashtable();

            htAllies.Add("TossThoseDigits2", currentRanking);
            htAllies.Add("141Masters", 1290);
            htAllies.Add("Pheejhmoo", 1232);
            htAllies.Add("DUNKNGOHAMZIES", 1289);
            htAllies.Add("YABO2", 1700);


            Hashtable htOpponents = new Hashtable();

            htOpponents.Add("TheMuffinMan97", 1567);
            htOpponents.Add("GXuanMing", 1800);
            htOpponents.Add("vampiresland", 1100);
            htOpponents.Add("XxlivewirexX", 1311);
            htOpponents.Add("Molegg", 1200);

            //calculate elo after match
            newRanking = client.calculateElo("141Masters", currentRanking, "win", htAllies, htOpponents);


            ConstantAdjustments consta = new ConstantAdjustments();
            string adjustments         = consta.AdjustMethod("TossThoseDigits2", "platinum", 1450, pathTokey); // adjust upper and lower limits; output: the name of the
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //create match
            Rating myRating = new Rating(1278, 1392, Rating.LOSE, Rating.WIN);

            myRating.GetNewRatings();

            //test 1
            MatchPlayer alex  = new MatchPlayer("alex", 643);
            MatchPlayer xyz   = new MatchPlayer("xyz", 2742);
            MatchPlayer asdas = new MatchPlayer("asdas");


            ELORanking game1 = new ELORanking(3);

            alex.Result  = ELORanking.MatchResult.Win;
            xyz.Result   = ELORanking.MatchResult.Lose;
            asdas.Result = ELORanking.MatchResult.Win;

            game1.Matchup.Add(alex);
            game1.Matchup.Add(xyz);
            game1.Matchup.Add(asdas);
            double asdass = asdas.Rating;

            double newRankingAlex  = game1.CalculateNewRatingForPlayer(alex);
            double newRankingxyz   = game1.CalculateNewRatingForPlayer(xyz);
            double newRankingasdas = game1.CalculateNewRatingForPlayer(asdas);

            alex.Rating = alex.NewRating;
            double tier = DataPlayer.getRatingBasedOnHighestTierAchieved("bronze");


            //test 2
            ELOClient client = new ELOClient();

            client.readSeedData("TheMuffinMan97");

            //test 3
            // if ranking = null
            double Ranking = client.calculateProvisionalElo("TheMuffinMan97", 0);

            //test 4
            Hashtable ht1 = new Hashtable();

            ht1.Add("TheMuffinMan97", "1234");


            Hashtable ht2 = new Hashtable();

            ht2.Add("Molegg", "2311");

            newRankingAlex = client.calculateElo("141Masters", 1222, "win", ht1, ht2);



            //for provisional

            /*
             * DataPlayer:getDivision(Database) -> if not found -> getLatest Division(Fetchy) -> add an initial base|
             *
             */

            // get data from last 10 matches: summnonerName, rating, outcome, Matches[10] matches -> to be implemented

            /* for each match that the player has participated
             *
             * ELORanking game = new ELORanking(10);
             * MatchPlayer opponents
             *
             * foreach(player in players)
             * {
             *    game.Matchup.Add(player)
             * }
             *
             * if outcome = LOST => foreach(player in opponents)
             *                  {
             *                          player.Result = ELORating.MatchResult.Win;
             *                  }
             * else...
             *
             * newRating = game.CalculateNewRatingForPlayer(summnonerName);
             *
             */
        }