//User wants to just use the default starting population for capuchins instead of a custom list //Simulates LV as of March 2020 //this is an awful setup but it works for now private void btnDefaultStart_Click(object sender, EventArgs e) { startingPop.Clear(); simpleInd sals = new simpleInd(1, 2, 296, true, 0, false, 11, 0); //male dep inf simpleInd chut = new simpleInd(2, 2, 253, false, 0, false, 12, 0); simpleInd oreg = new simpleInd(3, 2, 179, true, 0, false, 10, 0); // male dep inf simpleInd chch = new simpleInd(4, 2, 190, false, 0, false, 12, 0); simpleInd thym = new simpleInd(5, 2, 147, false, 0, false, 12, 0); simpleInd vani = new simpleInd(6, 2, 123, false, 0, false, 12, 0); simpleInd sage = new simpleInd(7, 2, 121, false, 0, false, 12, 0); simpleInd crys = new simpleInd(8, 2, 93, false, 0, false, 12, 0); simpleInd roux = new simpleInd(9, 1, 72, false, 0, false, 12, 0); simpleInd fres = new simpleInd(10, 1, 72, false, 0, false, 12, 0); simpleInd papr = new simpleInd(11, 1, 37, false, 0, false, 12, 0); simpleInd hari = new simpleInd(12, 1, 19, false, 0, false, 12, 0); startingPop.Add(sals); startingPop.Add(chut); startingPop.Add(oreg); startingPop.Add(chch); startingPop.Add(thym); startingPop.Add(vani); startingPop.Add(sage); startingPop.Add(crys); startingPop.Add(roux); startingPop.Add(fres); startingPop.Add(papr); startingPop.Add(hari); countID = 13; RefreshPopulation(startingPop, lstPop, txtStartPop); btnDefaultStart.Enabled = false; }
public double ReturnReprodMean(simpleInd i) { double repMean; if (i.AgeClass < 2) { repMean = 0; } else { repMean = afReprodMean; } return(repMean); }
public double ReturnReprodSd(simpleInd i) { double repSd; if (i.AgeClass < 2) { repSd = 0; } else { repSd = afReprodSd; } return(repSd); }
simpleInd indMethods = new simpleInd(); //methods access //Add button is clicked, user wants to add a monkey to starting population private void btnAdd_Click(object sender, EventArgs e) { //Step 1: retrieve data from form if (Validator.TextEntered(txtAge, "Age") && Validator.IsInt(txtAge, "Age") && Validator.WithinRange(txtAge, 0, 360, "Age")) { age = Convert.ToInt32(txtAge.Text); //get individual's age from form ageClass = indMethods.AssignAgeClass(age); //get an age class designation based on age simpleInd newInd = new simpleInd(countID, ageClass, age, false, 0, false, 0, 0); //create a new individual w no dependencies countID++; //Does an adult female have a dependent infant? If yes, get age and sex of infant //REFACTOR THIS INTO OWN METHOD if (chkDepInf.Checked) { if (Validator.TextEntered(txtInfAge, "Infant Age") && Validator.IsInt(txtInfAge, "Infant Age") && Validator.WithinRange(txtInfAge, 0, 11, "Infant Age")) { infAge = Convert.ToInt32(txtInfAge.Text); //how old is dependent infant? newInd.DepInf = true; //declare infant dependency newInd.MonthsSinceBirth = infAge; //add 6 months of pregnancy time to age if (rdoFemale.Checked) //dependent infant is a female, need to add a baby to population { simpleInd baby = new simpleInd(countID, 0, infAge, false, 0, false, 0, newInd.IndID); //create baby, link to mom countID++; newInd.DepInfFem = true; newInd.DepInfID = baby.IndID; //link mom to baby startingPop.Add(newInd); startingPop.Add(baby); } else //male baby, need to track but not add to population { newInd.DepInf = true; startingPop.Add(newInd); //mom is added with } } } else //no dependent infant info added, just add individual to population as is. { newInd.MonthsSinceBirth = 12; //no dependent, so assume it has been at least a year since ind had an infant startingPop.Add(newInd); } RefreshPopulation(startingPop, lstPop, txtStartPop); ResetForm(); } }
//add an individual to the population (right now only infant females) private void AddToPop(List <simpleInd> p, int momID) { simpleInd baby = new simpleInd(countID, 0, 0, false, 0, false, 0, momID); //create new female, link her to mom foreach (simpleInd ind in p) { if (ind.IndID == momID) { ind.DepInfID = baby.IndID; } } p.Add(baby); //add baby to pop countID++; //increment counter }