public static void insertPlayersRandomly(List <List <TournamentRound> > tree, List <TournamentPlayer> players)
        {
            List <TournamentRound> firstRow = tree[0];

            foreach (TournamentPlayer p in players.Where(p => p.getIsNPC() == false))
            {
                TournamentRound game = firstRow.OrderBy(g => g.getPlayers().Count).ToList()[0];
                game.addPlayer(p);
            }
        }
Exemple #2
0
        private void setHasPossibleBotGame()
        {
            TournamentRound game = this;

            do
            {
                game.hasPossibleBotGame = true;
                game = game.nextRound;
            }while (game != null);
        }
Exemple #3
0
        public int calcRoundsUntilPossibleBotGame()
        {
            int             steps = 0;
            TournamentRound round = this;

            while (round.hasPossibleBotGame == false && round.nextRound != null)
            {
                round = round.nextRound;
                steps++;
            }
            stashedRoundsUntilBotGame = steps;
            return(steps);
        }
        public static void addBots(List <List <TournamentRound> > tree, List <TournamentPlayer> players)
        {
            List <TournamentRound> firstRow = tree[0];
            int totalPlayers = firstRow.Count * 2;
            int botsNeeded   = totalPlayers - players.Count;

            for (int i = 0; i < botsNeeded; i++)
            {
                List <TournamentRound> temp = firstRow.OrderByDescending(g => g.calcRoundsUntilPossibleBotGame()).ToList(); //Calculate round to bot battle
                temp = temp.Where(g => g.stashedRoundsUntilBotGame == temp[0].stashedRoundsUntilBotGame).ToList();          //Sort

                TournamentRound  round = temp[Random.Range(0, temp.Count)];                                                 //Pick random game
                TournamentPlayer bot   = new TournamentPlayer(true, i);
                players.Add(bot);
                round.addPlayer(bot);
            }
        }
Exemple #5
0
 public void setNextGame(TournamentRound nextRound, int nextGameSlotIndex)
 {
     this.nextRound            = nextRound;
     this.nextWinGameSlotIndex = nextGameSlotIndex;
 }
Exemple #6
0
 public void setNextLoserGame(TournamentRound nextRound, int nextLoseGameSlotIndex)
 {
     this.nextLoserRound        = nextRound;
     this.nextLoseGameSlotIndex = nextLoseGameSlotIndex;
 }