Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Universe awesomeUniverse = new Universe("Awesome Universe");

            Random r = new Random();

            // Create 1000 Galaxies and add to Universe
            for (int i = 0; i < 1001; i++)
            {
                int numberOfWords = r.Next(1, 3);

                string name = string.Empty;

                for (int j = 0; j < numberOfWords; j++)
                {
                    name += potentialNames[r.Next(0, potentialNames.Length - 1)];
                }

                Galaxy galaxy = new Galaxy(name);
                Console.WriteLine(galaxy._name);

                awesomeUniverse.AddGalaxy(galaxy);
            }

            //for each Galaxy add 200 solar systems
            foreach (Galaxy gal in awesomeUniverse._galaxies)
            {
                for (int i = 0; i < 201; i++)
                {
                    SolarSystem solarSystem = new SolarSystem(i.ToString());

                    solarSystem.AddStar(new Star(i.ToString()));

                    for (int j = 0; j < 16; j++)
                    {
                        Planet planet = new Planet(j.ToString());

                        for (int k = 0; k < 10000; k++)
                        {
                            LifeForm lifeForm = new LifeForm(k.ToString(), i.ToString());
                            planet.AddLifeForm(lifeForm);
                        }
                        solarSystem.AddPlanet(planet);
                    }
                    gal.AddSolarSystem(solarSystem);
                }
            }

            Console.WriteLine("Press any key to exit");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
 public void AddLifeForm(LifeForm lifeForm)
 {
     _lifeForms.Add(lifeForm);
 }