public void TestRankingMethodMoveNext()
        {
            var humanPlayer = new HumanPlayer("Ivan", "3456");
            var ranklist = new Ranking<IPlayer>();
            ranklist.Add(humanPlayer);
            var move = ranklist.MoveNext();

            Assert.IsTrue(move);
        }
        public void TestRankingMethodAdd()
        {
            var humanPlayer = new HumanPlayer("Ivan", "3456");
            var ranklist = new Ranking<IPlayer>();
            ranklist.Add(humanPlayer);
            var expect = 1;

            Assert.AreEqual(expect, ranklist.Count);
        }
        public void TestRankingMethodDispose()
        {
            var humanPlayer = new HumanPlayer("Ivan", "3456");
            var ranklist = new Ranking<IPlayer>();
            ranklist.Add(humanPlayer);

            ranklist.Dispose();

            ////TODO
        }
Exemplo n.º 4
0
        private void UpdateRanking()
        {
            Ranking.Clear();
            var games   = new ResultService().GetGamesThatArePlayed();
            var ranking = new ScoreService().GetRanking(Users, games);

            foreach (var score in ranking)
            {
                Ranking.Add(score);
            }
        }
Exemplo n.º 5
0
        private async Task FetchMangaRanking()
        {
            Ranking.Clear();
            var modes = new[] { "day", "week_rookie", "week", "month" };

            foreach (var _ in modes)
            {
                var illusts = await _queryCacheService.RunAsync(_pixivClient.IllustV1.RankingAsync, mode => $"{_}_manga");

                if (illusts != null)
                {
                    Ranking.Add(new Tuple <RankingMode, IIllusts>(RankingModeExt.FromString(_), illusts));
                }
            }
        }
Exemplo n.º 6
0
        private async Task FetchIllustRanking()
        {
            Ranking.Clear();
            var modes = new[] { "day", "day_male", "day_female", "week_original", "week_rookie", "week", "month" };

            foreach (var _ in modes)
            {
                var illusts = await _queryCacheService.RunAsync(_pixivClient.IllustV1.RankingAsync, mode => _, filter => "for_ios");

                if (illusts != null)
                {
                    Ranking.Add(new Tuple <RankingMode, IIllusts>(RankingModeExt.FromString(_), illusts));
                }
            }
        }
Exemplo n.º 7
0
        private List <Individual <Element, Tuple <double, double> > > Elitism <Element>(List <Individual <Element, Tuple <double, double> > > population,
                                                                                        Ranking <Element> ranking)
        {
            List <Individual <Element,
                              Tuple <double, double> > > modifiedPopulation = modifyPopulation ? population :
                                                                              new List <Individual <Element,
                                                                                                    Tuple <double, double> > >(population);

            foreach (Individual <Element, Tuple <double, double> > individual in modifiedPopulation)
            {
                ranking.Add(individual);
            }

            ranking.Update();
            ranking.RemoveFrom(population.Count);

            modifiedPopulation.Clear();
            modifiedPopulation.AddRange(ranking.RankingList);

            return(modifiedPopulation);
        }