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); } }
private void setHasPossibleBotGame() { TournamentRound game = this; do { game.hasPossibleBotGame = true; game = game.nextRound; }while (game != null); }
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); } }
public void setNextGame(TournamentRound nextRound, int nextGameSlotIndex) { this.nextRound = nextRound; this.nextWinGameSlotIndex = nextGameSlotIndex; }
public void setNextLoserGame(TournamentRound nextRound, int nextLoseGameSlotIndex) { this.nextLoserRound = nextRound; this.nextLoseGameSlotIndex = nextLoseGameSlotIndex; }