Exemple #1
0
        private void CreateColony()
        {
            string name           = "";
            int    lifeCycle      = 0;
            int    chieldCount    = 0;
            int    divisionsCount = 0;
            int    tmax           = 0;
            int    tmin           = 0;

            Console.Write("Name = ");
            name = Console.ReadLine();
            if (envirenment.CheckName(name))
            {
                Console.Write("Colony already exists. Created copy");
                envirenment.AddColony(name, 0, 0, 0, 0, 0);
                return;
            }
            lifeCycle      = Check("Life Cycle =", @"^\d+$");
            chieldCount    = Check("Chield Count =", @"^\d+$", 1000);
            divisionsCount = Check("Divisions Count =", @"^\d+$", lifeCycle + 1);
            tmax           = Check("T max =", @"^[-]?\d+$");
            tmin           = Check("T min(<" + (tmax - 10).ToString() + ")=", @"^[-]?\d+$", tmax - 10);
            envirenment.AddColony(name, lifeCycle, chieldCount, divisionsCount, tmin, tmax);
        }