Beispiel #1
0
        public void GenerateTournament()
        {
            var tournament = PairingSimulation.GenerateTournament(7, 20);

            Assert.AreEqual(7, tournament.NumberOfRounds);
            Assert.AreEqual(20, tournament.Players.Count());
        }
Beispiel #2
0
        public void GeneratePlayerList()
        {
            var players = PairingSimulation.GeneratePlayerList(20, 1800, 2200);

            Assert.AreEqual(20, players.Count());
            Assert.IsTrue(players.Min(p => p.Rating) > 1800);
            Assert.IsTrue(players.Max(p => p.Rating) < 2200);
            //Check that all PlayerId are unique
            Assert.AreEqual(players.Count(), players.Select(p => p.PlayerId).Distinct().Count());
            //Check that all Ratings are unique
            Assert.AreEqual(players.Count(), players.Select(p => p.Rating).Distinct().Count());
        }
        private static void RunSimulationAndPrintResults(Game game)
        {
            const int numSamples = 100000;
            var       rs         = new RunningStat();

            rs.Clear();

            for (int i = 0; i < numSamples; ++i)
            {
                PairingSimulation.RandomizeResult(ref game);
                rs.Push(game.BlackResult);
            }
            PrintStatisticResults("normal", 32, 7 * 7, rs.Mean(), rs.Variance(), rs.resultlist.Min(), rs.resultlist.Max());
            PrintGameResultStats(rs);
        }
Beispiel #4
0
        public void SimulateTournament()
        {
            var numRounds  = 13;
            var tournament = PairingSimulation.GenerateTournament(numRounds, 60);

            PairingSimulation.SimulateTournament(tournament);
            Assert.AreEqual(numRounds, tournament.RoundList.Count);
            Assert.AreEqual(numRounds, tournament.Standings.Count);
//            Assert.IsFalse(AnyPlayerMetOpponentTwice(tournament));
            Console.WriteLine($"Top {GetTopPlayersMet(tournament)} played eachother");
            var finalStandings = tournament.Standings.Last();

            PrintStandings(finalStandings);
            PrintRoundByRoundResultsWithStandings(tournament.RoundList, tournament.Standings);
        }
Beispiel #5
0
        public void TestMethod1()
        {
            var tournament = PairingSimulation.GenerateTournament(7, 20);

            PappPairing.PairNextRound(tournament);
        }