Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();
            rand = new Random();
            rand2 = new Random(DateTime.Now.Millisecond + 5);

            savannah = new Savannah(rand, rand2, pictureBox1);
            /*
            savannah.printAll();
            Console.WriteLine("----------------------------------------");
            for (int i = 0; i < 20; i++)
            {
                for (int j = 0; j < 20; j++)
                {
                    if (savannah.fields[i, j].animal is Lion)
                    {
                        Console.Write("L ");
                    }
                    if (savannah.fields[i, j].animal is Rabbit)
                    {
                        Console.Write("R ");
                    }
                    if (savannah.fields[i, j].animal == null)
                    {
                        Console.Write("  ");
                    }
                }
                Console.WriteLine("|");
            }
            Console.WriteLine("----------------------------------------");
             //*/
            this.Closing += Form1_Closing;
        }
Esempio n. 2
0
 public Grass(Savannah s, int x, int y)
 {
     weight = 1 + s.rand1.NextDouble();
     isAlive = true;
     posX = x;
     posY = y;
 }
Esempio n. 3
0
 protected Animal(Savannah s, int x, int y)
 {
     savannah = s;
     newPosX = s.rand1;
     newPosY = s.rand2;
     posX = x;
     posY = y;
     gender = s.rand1.NextDouble() >= 0.5;
 }
Esempio n. 4
0
 public Lion(Savannah s, int x, int y)
     : base(s, x, y)
 {
     weight = 49 + s.rand1.NextDouble();
     speed = 1;
 }