def _insert_new_creature(self): new_creature = Creature( x=randrange(*self.game_bounds), y=randrange(*self.game_bounds), color=WHITE ) new_creature.vision_cone = VisionCone(parent=new_creature, x=265, color=RED) self.entities.append(new_creature.vision_cone) self._insert_creature(new_creature) return new_creature
def _breed_creature(self): new_weights = self.breeder.breed(list(self.get_creatures())) new_creature = Creature( x=randrange(*self.game_bounds), y=randrange(*self.game_bounds), nn_weights=new_weights ) new_creature.vision_cone = VisionCone(parent=new_creature, x=265, color=RED) self.entities.append(new_creature.vision_cone) self._insert_creature(new_creature) return new_creature