public Fox(Fox c)
     : base(c)
 {
     EatenThisWeek = c.EatenThisWeek;
     for (int i = 0; i < 7; i++)
         EatenEachDay[i] = c.EatenEachDay[i];
 }
 public Fox(Fox c) : base(c)
 {
     EatenThisWeek = c.EatenThisWeek;
     for (int i = 0; i < 7; i++)
     {
         EatenEachDay[i] = c.EatenEachDay[i];
     }
 }
        /// <summary>
        /// Simulates The Death Event of Foxes
        /// </summary>
        /// <param name="Date"the Day on which the Simulation Occurs</param>
        private void foxesDie(int Date)
        {
            List <Generation <Fox> > StillAlive = new List <Generation <Fox> >();

            foreach (Generation <Fox> fx in FoxesGenerations)
            {
                Random r         = new Random();
                float  deathprop = 0f;
                if (fx.Age > Fox.MedianAge)
                {
                    deathprop = (float)r.NextDouble();
                }
                List <Fox> alliveGen = new List <Fox>();
                for (int i = 0; i < fx.Count; i++)
                {
                    float t = (float)r.NextDouble();
                    if (fx[i].Hungry)
                    {
                        t += Fox.HungerDeathPropabilty;
                    }
                    if (t < deathprop)
                    {
                        Fox Allive = fx[i];
                        Allive.AgeOneDay();
                        alliveGen.Add(Allive);
                    }
                    else
                    {
                        FoxesCount--;
                    }
                }
                fx.Animals = alliveGen;
                if (fx.Count != 0)
                {
                    StillAlive.Add(fx);
                }
            }
            FoxesGenerations = StillAlive;
        }
        /// <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;
        }