public Creature( CreatureType type, double spontaneousBirthProbabilityPerStep, double deathProbabilityPerCreaturePerStep, double crowdingCoefficient, double replicationProbabilityPerStep, IReadOnlyDictionary <CreatureType, double> mutationWeights) { this.deathProbabilityPerCreaturePerStep = deathProbabilityPerCreaturePerStep; this.crowdingCoefficient = crowdingCoefficient; this.Type = type; this.SpontaneousBirthDistribution = Bernoulli.Distribution(spontaneousBirthProbabilityPerStep); this.ReplicationDistribution = Bernoulli.Distribution(replicationProbabilityPerStep); this.MutationDistribution = new Weighted <CreatureType>(mutationWeights); }
public IDistribution <bool> DeathDistribution(int currentPopulation) => Bernoulli.Distribution(this.deathProbabilityPerCreaturePerStep + this.crowdingCoefficient * currentPopulation);