예제 #1
0
        static void Main(string[] args)
        {
            Park Parc = new Park();

            Lion.ReproChance    = 0.6;
            Gazelle.ReproChance = 0.6;

            Lion Leonidette = new Lion(true, 0.7);
            Lion Leonidas   = new Lion(false, 0.7);


            Parc.AddAnimal(Leonidas);
            Parc.AddAnimal(Leonidette);

            int i = 10;

            while (i > 0)
            {
                Parc.AddAnimal(Lion.RandomLion());
                Parc.AddAnimal(Gazelle.RandomGazelle());

                i--;
            }


            i = 10;
            while (i > 0)
            {
                Console.WriteLine("ITS A NEW DAAAY");
                Console.WriteLine(Parc.CountAnimals());
                Parc.PrintStatus();
                Parc.GoThroughADay();
                i--;
            }
        }
예제 #2
0
 public override Predator DoubleReproduce(Predator b)
 {
     if (Utils.ChanceSucces(this.ReproductionChance * 2))
     {
         Lion cast = (Lion)b;
         return(new Lion(Utils.RandomSex(), cast.HuntSuccesChance / 2 + this.HuntSuccesChance / 2));
     }
     else
     {
         return(null);
     }
 }
예제 #3
0
 public override Animal Reproduce(Animal b)
 {
     if (Utils.ChanceSucces(this.ReproductionChance))
     {
         Lion cast = (Lion)b;
         return(new Lion(Utils.RandomSex(), cast.HuntSuccesChance / 2 + this.HuntSuccesChance / 2));
     }
     else
     {
         return(null);
     }
 }