Ejemplo n.º 1
0
        public static Monarchy Generate(int a)
        {
            Monarchy monarchy = new Monarchy();

            string[] continents = { "Asia", "Africa", "America", "Oceania", "Europe" };

            // Creating the element.
            for (int i = 0; i < rnd.Next(4, 20); i++)
            {
                monarchy.Name                   += (char)rnd.Next(65, 91);
                monarchy.LeaderName             += (char)rnd.Next(97, 123);
                monarchy.Age                    += rnd.Next(0, 150);
                monarchy.Population             += rnd.Next(0, 1000);
                monarchy.CurrentRullingClanName += (char)rnd.Next(65, 91);
            }

            monarchy.Continent = continents[rnd.Next(0, 5)];

            return(monarchy);
        }
Ejemplo n.º 2
0
        // Creating the collection.
        public static List <List <State> > CreateCollection()
        {
            // Getting all the continents counts.
            int africaCount  = CountInput("Enter the number of African countries: ");
            int asiaCount    = CountInput("Enter the number of Asian countries: ");
            int americaCount = CountInput("Enter the number of American countries: ");
            int oceaniaCount = CountInput("Enter the number of Oceanian countries: ");
            int europeCount  = CountInput("Enter the number of European countries: ");

            // List of the african countries.
            List <State> africaList = new List <State>();

            for (int i = 0; i < africaCount; i++)
            {
                // Creating a random element.
                Monarchy monarchy = Monarchy.Generate(i);
                // Setting its continent.
                monarchy.Continent = "Africa";
                // Adding to the list the State cope of the object.
                africaList.Add(monarchy.BaseState);
            }

            // List of the asian countries.
            List <State> asiaList = new List <State>();

            for (int i = 0; i < asiaCount; i++)
            {
                // Creating a random element.
                Monarchy monarchy = Monarchy.Generate(i);
                // Setting its continent.
                monarchy.Continent = "Asia";
                // Adding to the list the State cope of the object.
                asiaList.Add(monarchy.BaseState);
            }

            // List of the american countries.
            List <State> americaList = new List <State>();

            for (int i = 0; i < americaCount; i++)
            {
                // Creating a random element.
                Monarchy monarchy = Monarchy.Generate(i);
                // Setting its continent.
                monarchy.Continent = "America";
                // Adding to the list the State cope of the object.
                americaList.Add(monarchy.BaseState);
            }

            // List of the oceanian countries.
            List <State> oceaniaList = new List <State>();

            for (int i = 0; i < oceaniaCount; i++)
            {
                // Creating a random element.
                Monarchy monarchy = Monarchy.Generate(i);
                // Setting its continent.
                monarchy.Continent = "Oceania";
                // Adding to the list the State cope of the object.
                oceaniaList.Add(monarchy.BaseState);
            }

            // List of the european countries.
            List <State> europeList = new List <State>();

            for (int i = 0; i < europeCount; i++)
            {
                // Creating a random element.
                Monarchy monarchy = Monarchy.Generate(i);
                // Setting its continent.
                monarchy.Continent = "Europe";
                // Adding to the list the State cope of the object.
                europeList.Add(monarchy.BaseState);
            }

            // Creating the Earth collection.
            List <List <State> > earth = new List <List <State> >
            {
                africaList, asiaList, americaList, oceaniaList, europeList
            };

            return(earth);
        }