/// <summary>
        /// Displace animals according to the rules
        /// </summary>
        private void MoveAnimals()
        {
            List<List<GameCell>> result = new List<List<GameCell>>();
            for (int i = 0; i < Cells.Count; i++)
            {
                result.Add(new List<GameCell>());
                for (int j = 0; j < Cells[i].Count; j++)
                    result[i].Add(new GameCell());
            }
            Random random = new Random();
            for (int i = 0; i < Cells.Count; i++)
            {
                for (int j = 0; j < Cells[i].Count; j++)
                {
                    int numToTravel = (int)(Cells[i][j].RabbitsCount * Rabbit.RateOfTravel);
                    int alreadyTravelled = 0;
                    List<Tuple<int, int>> possibleDests = possibleDest(Tuple.Create(i, j), Rabbit.TravellingDistance);
                    List<float> rates = getRates(possibleDests.Count);
                    if (alreadyTravelled == numToTravel)
                        continue;
                    for (int dest = 0; dest < possibleDests.Count; dest++)
                    {
                        int travellersTothisDest = (int)(numToTravel * rates[dest]);
                        List<Generation<Rabbit>> destination = new List<Generation<Rabbit>>();
                        if (Cells[i][j].FoxesGenerations.Count == 0)
                            continue;
                        int gen = random.Next(Cells[i][j].RabbitsGenerations.Count);
                        int fromThisGen = random.Next(Math.Min(Cells[i][j].RabbitsGenerations[gen].Count, numToTravel - alreadyTravelled));
                        Generation<Rabbit> resGen = new Generation<Rabbit>(0);
                        for (int rab = 0; rab < fromThisGen; rab++)
                        {
                            int index = random.Next(Cells[i][j].RabbitsGenerations[gen].Count - 1);
                            Rabbit cur = Cells[i][j].RabbitsGenerations[gen][index];
                            resGen.Animals.Add(cur);
                            Cells[i][j].RabbitsGenerations[gen].Animals.RemoveAt(index);
                            alreadyTravelled++;
                        }
                        if (fromThisGen != 0)
                            destination.Add(resGen);
                        result[possibleDests[dest].Item1][possibleDests[dest].Item2].Merge(destination);
                    }
                }
            }
            for (int i = 0; i < Cells.Count; i++)
            {
                for (int j = 0; j < Cells[i].Count; j++)
                {
                    int numToTravel = (int)(Cells[i][j].FoxesCount * Fox.RateOfTravel);
                    int alreadyTravelled = 0;
                    List<Tuple<int, int>> possibleDests = possibleDest(Tuple.Create(i, j), Fox.TravellingDistance);
                    List<float> rates = getRates(possibleDests.Count);
                    if (alreadyTravelled == numToTravel)
                        continue;
                    for (int dest = 0; dest < possibleDests.Count; dest++)
                    {

                        int travellersTothisDest = (int)(numToTravel * rates[dest]);
                        List<Generation<Fox>> destination = new List<Generation<Fox>>();
                        if (Cells[i][j].FoxesGenerations.Count == 0)
                            continue;
                        int gen = random.Next(Cells[i][j].FoxesGenerations.Count);

                        int fromThisGen = random.Next(Math.Min(Cells[i][j].FoxesGenerations[gen].Count, numToTravel - alreadyTravelled));
                        Generation<Fox> resGen = new Generation<Fox>(0);
                        for (int fox = 0; fox < fromThisGen; fox++)
                        {
                            int index = random.Next(Cells[i][j].FoxesGenerations[gen].Count - 1);
                            Fox cur = Cells[i][j].FoxesGenerations[gen][index];
                            resGen.Animals.Add(cur);
                            Cells[i][j].FoxesGenerations[gen].Animals.RemoveAt(index);
                            alreadyTravelled++;
                        }
                        if (fromThisGen != 0)
                            destination.Add(resGen);
                        result[possibleDests[dest].Item1][possibleDests[dest].Item2].Merge(destination);
                    }
                }
            }
            for (int i = 0; i < Size.Item1; i++)
            {
                for (int j = 0; j < Size.Item2; j++)
                {
                    result[i][j].CopyMerge(Cells[i][j]);

                }
            }
            Cells = result;
        }
 /// <summary>
 /// Simulates the Multiplication Activity of Foxes
 /// </summary>
 /// <returns>
 /// Number of Foxes that were Born
 /// </returns>
 private int foxMultiplication()
 {
     int num = Fox.BirthRate[FoxesCount][RabbitsDensity] * (FoxesCount / 2);
     Generation<Fox> newBorn = new Generation<Fox>(num);
     FoxesGenerations.Add(newBorn);
     FoxesGenerations.Sort();
     return num;
 }
 /// <summary>
 /// Simulates the Multiplication Activity of Rabbits
 /// </summary>
 /// <returns>
 /// Number of Rabbits that were Born
 /// </returns>
 private int rabbitMultipliaction()
 {
     int num = Rabbit.BirthRate[RabbitsCount][VegetationLevel] * (RabbitsCount / 2);
     Generation<Rabbit> newBorn = new Generation<Rabbit>(num);
     RabbitsGenerations.Add(newBorn);
     RabbitsGenerations.Sort();
     return num;
 }
        /// <summary>
        /// Displace animals according to the rules
        /// </summary>
        private void MoveAnimals()
        {
            List <List <GameCell> > result = new List <List <GameCell> >();

            for (int i = 0; i < Cells.Count; i++)
            {
                result.Add(new List <GameCell>());
                for (int j = 0; j < Cells[i].Count; j++)
                {
                    result[i].Add(new GameCell());
                }
            }
            Random random = new Random();

            for (int i = 0; i < Cells.Count; i++)
            {
                for (int j = 0; j < Cells[i].Count; j++)
                {
                    int numToTravel      = (int)(Cells[i][j].RabbitsCount * Rabbit.RateOfTravel);
                    int alreadyTravelled = 0;
                    List <Tuple <int, int> > possibleDests = possibleDest(Tuple.Create(i, j), Rabbit.TravellingDistance);
                    List <float>             rates         = getRates(possibleDests.Count);
                    if (alreadyTravelled == numToTravel)
                    {
                        continue;
                    }
                    for (int dest = 0; dest < possibleDests.Count; dest++)
                    {
                        int travellersTothisDest = (int)(numToTravel * rates[dest]);
                        List <Generation <Rabbit> > destination = new List <Generation <Rabbit> >();
                        if (Cells[i][j].FoxesGenerations.Count == 0)
                        {
                            continue;
                        }
                        int gen                    = random.Next(Cells[i][j].RabbitsGenerations.Count);
                        int fromThisGen            = random.Next(Math.Min(Cells[i][j].RabbitsGenerations[gen].Count, numToTravel - alreadyTravelled));
                        Generation <Rabbit> resGen = new Generation <Rabbit>(0);
                        for (int rab = 0; rab < fromThisGen; rab++)
                        {
                            int    index = random.Next(Cells[i][j].RabbitsGenerations[gen].Count - 1);
                            Rabbit cur   = Cells[i][j].RabbitsGenerations[gen][index];
                            resGen.Animals.Add(cur);
                            Cells[i][j].RabbitsGenerations[gen].Animals.RemoveAt(index);
                            alreadyTravelled++;
                        }
                        if (fromThisGen != 0)
                        {
                            destination.Add(resGen);
                        }
                        result[possibleDests[dest].Item1][possibleDests[dest].Item2].Merge(destination);
                    }
                }
            }
            for (int i = 0; i < Cells.Count; i++)
            {
                for (int j = 0; j < Cells[i].Count; j++)
                {
                    int numToTravel      = (int)(Cells[i][j].FoxesCount * Fox.RateOfTravel);
                    int alreadyTravelled = 0;
                    List <Tuple <int, int> > possibleDests = possibleDest(Tuple.Create(i, j), Fox.TravellingDistance);
                    List <float>             rates         = getRates(possibleDests.Count);
                    if (alreadyTravelled == numToTravel)
                    {
                        continue;
                    }
                    for (int dest = 0; dest < possibleDests.Count; dest++)
                    {
                        int travellersTothisDest             = (int)(numToTravel * rates[dest]);
                        List <Generation <Fox> > destination = new List <Generation <Fox> >();
                        if (Cells[i][j].FoxesGenerations.Count == 0)
                        {
                            continue;
                        }
                        int gen = random.Next(Cells[i][j].FoxesGenerations.Count);

                        int fromThisGen         = random.Next(Math.Min(Cells[i][j].FoxesGenerations[gen].Count, numToTravel - alreadyTravelled));
                        Generation <Fox> resGen = new Generation <Fox>(0);
                        for (int fox = 0; fox < fromThisGen; fox++)
                        {
                            int index = random.Next(Cells[i][j].FoxesGenerations[gen].Count - 1);
                            Fox cur   = Cells[i][j].FoxesGenerations[gen][index];
                            resGen.Animals.Add(cur);
                            Cells[i][j].FoxesGenerations[gen].Animals.RemoveAt(index);
                            alreadyTravelled++;
                        }
                        if (fromThisGen != 0)
                        {
                            destination.Add(resGen);
                        }
                        result[possibleDests[dest].Item1][possibleDests[dest].Item2].Merge(destination);
                    }
                }
            }
            for (int i = 0; i < Size.Item1; i++)
            {
                for (int j = 0; j < Size.Item2; j++)
                {
                    result[i][j].CopyMerge(Cells[i][j]);
                }
            }
            Cells = result;
        }