Ejemplo n.º 1
0
        //Clone ind, used to keep starter population separate from tested pop
        public static Ind CloneInd(Ind i)
        {
            Ind clonedInd = new Ind();

            clonedInd.IndID      = i.IndID;
            clonedInd.Age        = i.Age;
            clonedInd.IsPreg     = i.IsPreg;
            clonedInd.MonthsPreg = i.MonthsPreg;
            clonedInd.MonthsSinceBirthOrInfDeath = i.MonthsSinceBirthOrInfDeath;
            clonedInd.DepMaleInf  = i.DepMaleInf;
            clonedInd.DepMaleAge  = i.DepMaleAge;
            clonedInd.DepInfID    = i.DepInfID;
            clonedInd.MotherID    = i.MotherID;
            clonedInd.PrevInfSurv = i.PrevInfSurv;
            return(clonedInd);
        }
Ejemplo n.º 2
0
 //Female has been pregnant for GESTATION LENGTH, so reset pregnancy variables, give birth. If baby female, create new ind.
 public void GiveBirth()
 {
     IsPreg     = false;                                               //ind gives birth and is no longer pregnant, reset flag
     MonthsPreg = 0;                                                   //reset MonthsPreg counter to 0
     MonthsSinceBirthOrInfDeath = 0;                                   //reset "months since birth" counter to 0
     PrevInfSurv = true;                                               //this baby is born and alive
     if (MathFunctions.CoinFlip(VitalRates.SEXRATIO))                  //determine sex of infant. TRUE is female, so create a new ind in population
     {
         DepInfID = idCount;                                           //link female to mother
         Ind baby = new Ind(0, false, 0, false, 0, 0, IndID, 0, true); //create new baby
         Population.newFemInf.Add(baby);                               //add to the new baby collection for the month
         //MessageBox.Show("New female infant born, ID# " + baby.IndID + " , mother is #" + baby.MotherID);
         Trial.TrialFemBirths++;
     }
     else //male baby
     {
         DepMaleInf = true;
         //MessageBox.Show("Male baby born to mother " + IndID);
         Trial.TrialMaleBirths++;
     }
 }