Пример #1
0
        public void AddRabbit()
        {
            int  x      = rnd.Next(1, 3);
            bool z      = false;
            int  weight = 20;

            if (x == 1)
            {
                z = true;
            }
            int tryLocation = rnd.Next(0, 400);

            while (SavannaGrid[tryLocation].lionCheck() == true || SavannaGrid[tryLocation].rabbitCheck() == true)
            {
                tryLocation = rnd.Next(0, 400);
            }
            Rabbit R = new Rabbit(z, weight, tryLocation);

            SavannaGrid[tryLocation].maleIfTrue = z;
            RabbitList.Add(R);
        }
Пример #2
0
        public void MaleRabbitsDoStuff(Rabbit rabbit)
        {
            int x = 0;
            int z = rabbit.location;

            while (Initialize.SavannaGrid[exec.MoveRabbit(rnd.Next(1, 9), rabbit.location)].lionCheck() == true || Initialize.SavannaGrid[exec.MoveRabbit(rnd.Next(1, 9), rabbit.location)].rabbitCheck() == true && x != z)
            {
                x = exec.MoveLion(rnd.Next(1, 9), rabbit.location);
            }
            rabbit.location = x;
            Initialize.SavannaGrid[x].addRabbitToField();
            rabbit.weight = rabbit.weight - 1;


            if (chk.CheckForRabbitMateForMale(x) == true)
            {
                inst.AddRabbit();
                inst.AddRabbit();
                inst.AddRabbit();
                inst.AddRabbit();
            }
            if (food.checkForRabbitFood(x) == true)
            {
                rabbit.weight = rabbit.weight + 20;
            }
            if (rabbit.weight <= 0)
            {
                Initialize.RabbitList.Remove(rabbit);
            }


            Console.WriteLine(rabbit.weight);
            Console.WriteLine(rabbit.genderMaleIfTrue);
            Console.WriteLine(rabbit.location);
            Console.WriteLine(" ");
        }