Ejemplo n.º 1
0
 public MatchResult Clone()
 {
     var mr = new MatchResult();
     mr.SetMatchID(matchID);
     mr.SetTeamAID(teamAID);
     mr.SetTeamAScore(teamAScore);
     mr.SetTeamBID(teamBID);
     mr.SetTeamBScore(teamBScore);
     mr.SetPlayed(played);
     if (dummyGame)
     {
         mr.SetDummyGame(dummyGame);
     }
     return mr;
 }
Ejemplo n.º 2
0
        public void GenerateRandomMatches(List<int> teamIDs)
        {
            var cloneTeamIDs = LadderUtil.CloneIntList(teamIDs);
            var totalTeams = cloneTeamIDs.Count;
            var totalMatches = 0;
            var nextTier = LadderUtil.GetTierCount(totalTeams);
            totalMatches = (int)(totalTeams - Math.Pow(2, nextTier - 1));

            for (int i = 0; i < totalMatches; i++)
            {
                var teamAID = GetRandomTeam(cloneTeamIDs);
                var teamBID = GetRandomTeam(cloneTeamIDs);
                currentTeams.Add(teamAID);
                currentTeams.Add(teamBID);

                var match = new MatchResult();
                match.SetTeamAID(teamAID);
                match.SetTeamBID(teamBID);
                match.SetMatchID(i);
                matches.Add(i, match);
            }

            var tierMatches = Math.Pow(2, nextTier - 1);
            for (int i = totalMatches; i < tierMatches; i++)
            {
                var teamAId = GetRandomTeam(cloneTeamIDs);
                currentTeams.Add(teamAId);
                var match = new MatchResult();
                match.SetTeamAID(teamAId);
                match.SetDummyGame(true);
                matches.Add(i, match);
            }
        }