def test_adulthood_effects(): crew = initial.test_crew_adult() Gene.get_dominant(crew[0].genome[0]).adult_effects(crew[0]) Gene.get_dominant(crew[1].genome[0]).adult_effects(crew[1]) if crew[0].empathy != 1: print "Adult effects incorrectly applied to dominant adult" if crew[1].empathy != -1: print "Adult effects incorrectly applied to recessive adult"
def test_birth_effects(): crew = initial.test_crew_infant() Gene.get_dominant(crew[0].genome[0]).birth_effects(crew[0]) Gene.get_dominant(crew[1].genome[0]).birth_effects(crew[1]) if crew[0].empathy != 1: print "Birth effects incorrectly applied to dominant child" if crew[1].empathy != -1: print "Birth effects incorrectly applied to recessive child"
def be_born(self, dad=None, mom=None): self.set_parents(dad, mom) last_name = mom.name.split(' ')[1] self.set_sex() self.set_name(last_name) self.inherit() for gene in self.genome: Gene.get_dominant(gene).birth_effects(self)
def test_dominance(): gene1 = Gene() gene2 = Gene() gene1.locus = 0 gene2.locus = 0 gene2.condition = "dom" gene2.dominant = True # Gene.get_dominant(gene1) pair = [gene1, gene2] if Gene.get_dominant(pair).condition != "dom": print "Error, dominant gene isn't working"
def become_adult(self): print self.name + " crew id:" + str(self.crew_id) + " has become an adult" self.adult = True for gene in self.genome: Gene.get_dominant(gene).adult_effects(self)