def _init_retcon_marriage(self, spouse):
"""Jump back in time to instantiate a marriage that began outside the town."""
config = self.sim.config
# Change actual sim year to marriage year, instantiate a Marriage object
marriage_date = self.birth_year + (
random.normalvariate(
config.person_ex_nihilo_age_at_marriage_mean, config.person_ex_nihilo_age_at_marriage_sd
)
)
if (
# Make sure spouses aren't too young for marriage and that marriage isn't slated
# to happen after the town has been founded
marriage_date - self.birth_year < config.person_ex_nihilo_age_at_marriage_floor or
marriage_date - spouse.birth_year < config.person_ex_nihilo_age_at_marriage_floor or
marriage_date >= self.sim.true_year
):
# If so, don't bother regenerating -- just set marriage year to last year and move on
marriage_date = self.sim.true_year - 1
self.sim.year = int(round(marriage_date))
self.marry(spouse)
评论列表
文章目录