Exemple #1
0
        private void DistributeQuarterBacks()
        {
            int smallestQbQty = 0;
            int teamNumber    = 0;

            for (int i = 0; i < playersList.Count; i++)
            {
                if (playersList[i].proficientQB == true)
                {
                    do
                    {
                        teamNumber = RandomNumberGen.GenerateNumber(0, teamsList.Count);
                    } while (teamsList[teamNumber].quarterBackCount > smallestQbQty); //Ensures a quarterback can't be added to an already QB-stacked team.
                    teamsList[teamNumber].roster.Add(playersList[i]);
                    teamsList[teamNumber].quarterBackCount++;
                    playersList[i].team = i + 1;
                    smallestQbQty       = teamsList[0].quarterBackCount;
                    for (int j = 0; j < teamsList.Count; j++)//Every time a quarterback is added to a team, find what team has the least QB's.
                    {
                        if (teamsList[j].quarterBackCount < smallestQbQty)
                        {
                            smallestQbQty = teamsList[j].quarterBackCount;
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void DistributeNonQBPlayers()
        {
            int randomTeamNumber;

            for (int i = 0; i < playersList.Count; i++)
            {
                if (playersList[i].proficientQB == false)
                {
                    do
                    {
                        randomTeamNumber = RandomNumberGen.GenerateNumber(0, teamsList.Count);
                    } while (teamsList[randomTeamNumber].roster.Count + 1 > teamsList[randomTeamNumber].maxNumberOfPlayers);
                    teamsList[randomTeamNumber].roster.Add(playersList[i]);
                    playersList[i].team = randomTeamNumber + 1;
                }
            }
        }