Difference between revisions of "If a fox eats more food than it needs its reproduction rate/coefficient increases"
(Created page with "<syntaxhighlight lang="csharp"> //This "else" statement has been added to increase the Reproduction Rate if the fox has eaten as much as, or more than, it needs. if (FoodUnits...") |
|||
Line 11: | Line 11: | ||
else | else | ||
{ | { | ||
− | ReproductionBonus = 0. | + | ReproductionBonus = 0.3; |
if (ShowDetail) | if (ShowDetail) | ||
{ | { | ||
− | Console.WriteLine(" Fox wants some poon because he ate too much. Reproduction Rate increased by 0. | + | Console.WriteLine(" Fox wants some poon because he ate too much. Reproduction Rate increased by 0.3 for this turn."); |
} | } | ||
} | } |
Revision as of 12:38, 14 February 2017
<syntaxhighlight lang="csharp"> //This "else" statement has been added to increase the Reproduction Rate if the fox has eaten as much as, or more than, it needs. if (FoodUnitsConsumedThisPeriod < FoodUnitsNeeded)
{ CalculateNewAge(); if (ShowDetail) { Console.WriteLine(" Fox ages further due to lack of food."); } } else { ReproductionBonus = 0.3; if (ShowDetail) { Console.WriteLine(" Fox wants some poon because he ate too much. Reproduction Rate increased by 0.3 for this turn."); } }
// To implement this change, a "ReproductionBonus" variable has been created within the fox class: private double ReproductionBonus = 0;
//The new ReproductionBonus is implemented to affect the Reproduction Rate as shown below:
public bool ReproduceThisPeriod() { double ReproductionProbability = 0.25 + ReproductionBonus; if (Rnd.Next(0, 100) < ReproductionProbability * 100) { return true; } else { return false; } }