Exemplo n.º 1
0
        string getstats()
        {
            string stats     = string.Format("Combat {0} / {1}", ncombat, allcombats.Count) + "\\n";
            var    standings = generator.GenerateRankings();
            int    n         = 0;
            string salida    = "";

            foreach (var standing in standings)
            {
                if (n == 0)
                {
                    salida = "<font style='color:yellow'>";
                }
                else
                {
                    salida = "";
                }
                salida += string.Format("{0} {1} {2}", standing.Rank.ToString(), teamNames[standing.Team.TeamId], standing.ScoreDescription);
                if (n == 2)
                {
                    salida += "</font>";
                }

                stats += salida + "\\n";
                n++;
            }
            return("{\"scores\":\"" + stats + "\",\"console\":\"" + actualCombatLog + "\"}");
        }
Exemplo n.º 2
0
        string getstats()
        {
            string stats     = string.Format("Combat {0} / {1}", ncombat, allcombats.Count) + "\\n\\n";
            var    standings = generator.GenerateRankings();

            foreach (var standing in standings)
            {
                string salida = string.Format("{0} {1} {2}", standing.Rank.ToString(), teamNames[standing.Team.TeamId], standing.ScoreDescription);
                stats += salida + "\\n";
            }
            return("{\"scores\":\"" + stats + "\",\"console\":\"" + actualCombatLog + "\"}");
        }
Exemplo n.º 3
0
        public void RoundRobinHandlesManyCompetitorsWell()
        {
            IPairingsGenerator pg = new RoundRobinPairingsGenerator();

            List <TournamentTeam>  teams  = new List <TournamentTeam>(CreateTeams(30));
            List <TournamentRound> rounds = new List <TournamentRound>();

            try
            {
                RunTournament(pg, teams, rounds, true, null);

                DisplayTournamentRounds(rounds);
                DisplayTournamentRankings(pg.GenerateRankings());
            }
            catch (InvalidTournamentStateException)
            {
                Assert.Fail();
            }
        }
Exemplo n.º 4
0
        public void RoundRobinTieForSecond()
        {
            IPairingsGenerator rrpg = new RoundRobinPairingsGenerator();

            List <TournamentTeam> teams = new List <TournamentTeam>(CreateTeams(3));

            try
            {
                List <TournamentRound> rounds = new List <TournamentRound>();
                rounds.AddRange(RounRobinBuildAllPairings(teams, rrpg));

                Assert.AreEqual(3, rounds.Count);

                rounds[0].Pairings[0].TeamScores[0].Score = new HighestPointsScore(1.0d);  // A: Win
                rounds[0].Pairings[0].TeamScores[1].Score = new HighestPointsScore(0.0d);  // B: Loss

                rounds[1].Pairings[0].TeamScores[0].Score = new HighestPointsScore(1.0d);  // A: Win
                rounds[1].Pairings[0].TeamScores[1].Score = new HighestPointsScore(0.0d);  // C: Loss

                rounds[2].Pairings[0].TeamScores[0].Score = new HighestPointsScore(0.5d);  // B: Draw
                rounds[2].Pairings[0].TeamScores[1].Score = new HighestPointsScore(0.5d);  // C: Draw

                DisplayTournamentRounds(rounds);

                rrpg.LoadState(teams, rounds);
                List <TournamentRanking> rankings = new List <TournamentRanking>(rrpg.GenerateRankings());

                DisplayTournamentRankings(rankings);

                Assert.AreEqual(3, rankings.Count);
                Assert.AreEqual(1, rankings[0].Rank);
                Assert.AreEqual(2, rankings[1].Rank);
                Assert.AreEqual(2, rankings[2].Rank);
            }
            catch (InvalidTournamentStateException)
            {
                Assert.Fail();
            }
        }