From 2634391e5b9b286b89558275fd14efd7298dfa0c Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Wed, 27 Jul 2022 20:22:18 -0500 Subject: [PATCH] Update evo.py --- evo.py | 528 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 332 insertions(+), 196 deletions(-) diff --git a/evo.py b/evo.py index 30d6083..bef0a6d 100644 --- a/evo.py +++ b/evo.py @@ -1,9 +1,13 @@ # To Do # poop # love/hate bonus +# kin affects movement (kin can do more in general) +# remove relentless? prune props & simplify # rewrite stats method :( # modularize this whole thing # society detection/shift mechanism +# performance +# seems sometimes lifeforms in world and alivelist don't match import os import random @@ -16,31 +20,32 @@ draw_world = True save_all_drawings = False save_some_drawings = 17 # 0 for no, otherwise months for how frequent to snap a shot -genesis_count = 1000 # how many lifeforms to start with -world_size = 75 # how big is the flat earth +genesis_count = 100 # how many lifeforms to start with +world_size = 25 # how big is the flat earth apocalypse_years = 999 # how many yaers until no more months can pass months_in_a_year = 12 # how many months in a year roll_max = 100 # the upper bound for rolls lifeform_draw_size = 5 # how many pixels a lifeform will get when drawn on the world_board + font_size = round(world_size/3) if world_size <= 126 else 42 -min_energy = 800 -max_energy = 1000 +min_health = 800 +max_health = 1000 lifetime_min_start = 20 lifetime_max_start = 50 -maturity_min_start = 14 -maturity_max_start = 19 +maturity_min_start = 12 +maturity_max_start = 17 luck_min_start = 1 luck_max_start = 8 diligent_min_start = 1 diligent_max_start = 5 wit_min_start = 0 -wit_max_start = 8 +wit_max_start = 24 speed_min_start = 2 speed_max_start = 7 restless_min_start = 0 restless_max_start = 4 -gestation_min_start = 7 -gestation_max_start = 10 +gestation_min_start = 5 +gestation_max_start = 8 hunger_start = 0 piggy_min_start = 2 piggy_max_start = 7 @@ -60,8 +65,8 @@ beauty_min_start = 20 beauty_max_start = 40 reach_min_start = 1 reach_max_start = 4 -skill_min_start = 8 -skill_max_start = 24 +skill_min_start = 1 +skill_max_start = 4 kinship_min_start = 7 kinship_max_start = 14 @@ -75,7 +80,10 @@ apocalypse = apocalypse_years*months_in_a_year world = [[None for i in range(world_size)] for j in range(world_size)] alive_list = [] run_id = int(round(datetime.now().timestamp())) -detail_csv_file = open(os.path.join(os.path.dirname(os.path.realpath(__file__)), f"{run_id}.csv"), "a+") +run_path = os.path.join(os.path.join(os.path.dirname(__file__), "trials"), f"{run_id}") +if not os.path.exists(run_path): + os.makedirs(run_path) +detail_csv_file = open(os.path.join(run_path, f"{run_id}.csv"), "a+") pygame.init() world_board=pygame.display.set_mode([world_size*lifeform_draw_size*6 + 5, world_size*lifeform_draw_size*2 + 1]) font = pygame.font.SysFont(None, font_size) @@ -88,10 +96,15 @@ class LifeFormColors: medium = (255, 255, 0) high = (0, 255, 0) - class Hunger: - low = (0, 255, 0) - medium = (255, 255, 0) - high = (255, 0, 0) + class Skill: + expert = (193, 154, 108) + proficient = (186, 138, 101) + competent = (179, 122, 95) + beginner = (171, 106, 88) + novice = (164, 90, 81) + apprentice = (142, 0, 0) + # child = (201, 246, 255) + child = (0, 0, 0) class Hates: hostility = (165, 42, 42) @@ -108,12 +121,12 @@ class LifeFormColors: charm = (244, 164, 96) beauty = (240, 255, 255) food = (245, 222, 179) - energy = (255, 0, 255) + health = (255, 0, 255) joy = (255, 20, 147) hostility = (255, 69, 0) kinship = (139, 69, 19) - class Energy: + class Health: excess = (246, 189, 192) high = (241, 149, 155) medium = (240, 116, 112) @@ -121,12 +134,12 @@ class LifeFormColors: dying = (220, 28, 19) class Joy: - tops = (0, 0, 0) - excess = (208, 239, 255) - high = (42, 157, 244) - medium = (24, 123, 205) - low = (17, 103, 177) - dying = (3, 37, 76) + tops = (255, 198, 109) + excess = (255, 222, 195) + high = (255, 248, 252) + medium = (199, 212, 255) + low = (165, 185, 255) + dying = (155, 176, 255) class Lifetime: baby = (132, 255, 159) @@ -154,26 +167,32 @@ class LifeFormColors: pregnant = (237, 255, 0) class Beauty: - excess = (37, 44, 88) - high = (215, 114, 124) - medium = (219, 202, 183) - low = (63, 41, 5) - dying = (189, 160, 106) + excess = (44, 196, 250) + high = (150, 226, 246) + medium = (164, 176, 196) + low = (98, 112, 157) + dying = (9, 26, 95) class Luck: - excess = (237, 140, 140) - high = (235, 34, 37) - medium = (237, 140, 140) - low = (187, 196, 200) - dying = (116, 132, 148) + excess = (214, 228, 217) + high = (172, 201, 178) + medium = (131, 174, 140) + low = (89, 147, 101) + dying = (48, 120, 63) class Heart: - # fought = (255, 255, 0) - love = (255, 192, 203) - hate = (255, 0, 0) + give_fight_trade = (192, 192, 192) # grey + give_fight = (155, 38, 182) # purple + give_trade = (0, 128, 128) # teal + fight_trade = (255, 165, 0) # orange + giver = (0, 0, 255) # blue + entrepreneur = (0, 255, 0) # green + fighter = (255, 0, 0) # red + lover = (255, 156, 136) # pink + hater = (255, 255, 0) # yellow class LifeForm: - loves = ["wit", "luck", "skill", "diligent", "charm", "beauty", "food", "energy", "joy", "hostility", "kinship"] + loves = ["wit", "luck", "skill", "diligent", "charm", "beauty", "food", "health", "joy", "hostility", "kinship"] hates = ["hostility", "piggy", "greed", "miserly", "lifetime"] def __init__(self): @@ -184,7 +203,7 @@ class LifeForm: self.wit = 0 # how many turns ahead a lifeform can try to optimize strategies for dependent props # death properties - self.energy = 0 # how far from death the lifeform is + self.health = 0 # how far from death the lifeform is self.lifetime = 0 # how many turns a lifeform has been alive # movement properties @@ -199,8 +218,8 @@ class LifeForm: self.gestation = 0 # how many turns it takes for a new lifeform to birth self.birth_month = 0 # what month the lifeform was born - # energy properties - self.hunger = 0 # numerical value representing current hunger, affects energy + # health properties + self.hunger = 0 # numerical value representing current hunger, affects health self.piggy = 0 # how much food a lifeform tries to eat a turn self.food = 0 # how much food a lifeform owns self.greed = 0 # factor of actual need greater that lifeform requires @@ -215,7 +234,7 @@ class LifeForm: self.kinship = 0 # how much a lifeform cares about its kin self.family = "" self.name = "" - self.love = "" # which lifeform property a lifeform wants to be around [wit, luck, skill, diligent, charm, beauty, food, energy] + self.love = "" # which lifeform property a lifeform wants to be around [wit, luck, skill, diligent, charm, beauty, food, health] self.hate = "" # which lifeform property a lifeform wants to avoid [fights, piggy, greed, miserly, lifetime] self.hate_first = False # whether or not the love or its hate is more driving @@ -233,22 +252,29 @@ class LifeForm: self.paternal_genes = {} self.baby_daddy = None self.mated_recently = False + self.fought_recently = False + self.gave_recently = False + self.trade_recently = False self.scars = 0 # primary repeated method def take_turn(self, month): + self.fought_recently = False + self.mated_recently = False + self.gave_recently = False + self.trade_recently = False for action in self.actions: action(month) # lifecycle methods - def _spawn(self, x, y, id, male, birth_month, luck=0, diligent=0, wit=0, skill=0, energy=0, lifetime=0, + def _spawn(self, x, y, id, male, birth_month, luck=0, diligent=0, wit=0, skill=0, health=0, lifetime=0, speed=0,restless=0, mature=False, gestation=0, hunger=0, piggy=0, food=0, greed=0, joy=0, miserly=0, charm=0, beauty=0, reach=0, kinship=0, name="", family="", mature_age=0, hostility=0): self.luck=luck self.diligent=diligent self.wit=wit self.skill=skill - self.energy=energy + self.health=health self.lifetime=lifetime self.speed=speed self.restless=restless @@ -275,7 +301,7 @@ class LifeForm: self.x=x self.y=y self.id=id - self.actions = [self.move, self.forage, self.mingle, self.pregnancy, self.eat, self.push] + self.actions = [self.move, self.forage, self.interact, self.pregnancy, self.eat, self.push] self.love = random.choice(self.loves) self.hate = random.choice(self.hates) self.hate_first = random.choice([True, False]) @@ -297,15 +323,13 @@ class LifeForm: self.hate = hate self.hate_first = hate_first self.birth_month = birth_month - self.actions = [self.move, self.forage, self.mingle, self.pregnancy, self.eat, self.push] + self.actions = [self.move, self.forage, self.interact, self.pregnancy, self.eat, self.push] random.shuffle(self.actions) self.actions.append(self.age) for key in mother_genes.keys(): mod = [mother_genes[key], father_genes[key]] mod.sort() - if key == "skill": - mod[0] = round(mod[0]/2) setattr(self, key, random.randrange(mod[0], mod[1] + 1)) luck_improve_roll = random.randrange(0, roll_max) # maybe [0, luck^2), some social component should be in here when switching to {{society style}} @@ -357,9 +381,6 @@ class LifeForm: self.hate = random.choice(self.hates) def _die(self): - alive_list.remove(self) - world[self.x][self.y] = None - child_luck_sum = 0 for child in self.children: child_luck_sum = child_luck_sum + child.luck @@ -367,8 +388,11 @@ class LifeForm: if inheritance_roll < child_luck_sum: inheritance_split = len(self.children) + 1 for child in self.children: - child.food = child.food + round(self.food/inheritance_split) + child.food = child.food + self.food//inheritance_split self.food = 0 + world[self.x][self.y] = None + alive_list.remove(self) + del self # core actions def move(self, _): @@ -377,13 +401,13 @@ class LifeForm: original_y = self.y target_x = original_x target_y = original_y - delta_x = random.randrange(-1*self.speed, self.speed + 1) - delta_y = random.randrange(-1*self.speed, self.speed + 1) - while steps_taken < self.restless: + delta_x = random.randrange(-1, 2) + delta_y = random.randrange(-1, 2) + while steps_taken < self.restless*self.speed: target_x = self.x + delta_x target_y = self.y + delta_y - delta_x = random.randrange(-1*self.speed, self.speed + 1) - delta_y = random.randrange(-1*self.speed, self.speed + 1) + delta_x = random.randrange(-1, 2) + delta_y = random.randrange(-1, 2) if self.wit > 0 and not self.pregnant: property_consideration = self.love if self.hate_first: @@ -404,28 +428,28 @@ class LifeForm: target_y = target_neighbor.y if target_neighbor is not None and self.hate_first: if target_neighbor.x > self.x: - delta_x = -self.speed if target_neighbor.x - self.x > self.speed else -random.randrange(0, target_neighbor.x - self.x) + delta_x = -1 elif target_neighbor.x < self.x: - delta_x = self.speed if self.x - target_neighbor.x > self.speed else random.randrange(0, self.x - target_neighbor.x) + delta_x = 1 else: delta_x = random.choice([1,-1]) if target_neighbor.y > self.y: - delta_y = -self.speed if target_neighbor.y - self.y > self.speed else -random.randrange(0, target_neighbor.y - self.y) + delta_y = -1 elif target_neighbor.y < self.y: - delta_y = self.speed if self.y - target_neighbor.y > self.speed else random.randrange(0, self.y - target_neighbor.y) + delta_y = 1 else: delta_y = random.choice([1,-1]) elif target_neighbor is not None: if target_neighbor.x > self.x: - delta_x = self.speed if target_neighbor.x - self.x > self.speed else random.randrange(0, target_neighbor.x - self.x) + delta_x = 1 elif target_neighbor.x < self.x: - delta_x = -self.speed if self.x - target_neighbor.x > self.speed else -random.randrange(0, self.x - target_neighbor.x) + delta_x = -1 else: delta_x = 0 if target_neighbor.y > self.y: - delta_y = self.speed if target_neighbor.y - self.y > self.speed else random.randrange(0, target_neighbor.y - self.y) + delta_y = 1 elif target_neighbor.y < self.y: - delta_y = -self.speed if self.y - target_neighbor.y > self.speed else -random.randrange(0, self.y - target_neighbor.y) + delta_y = -1 else: delta_y = 0 x = (self.x + delta_x + world_size) % world_size @@ -464,28 +488,32 @@ class LifeForm: pushed = 0 for neighbor in neighbors: if pushed < self.hostility: - x = (neighbor.x + random.choice([1,-1])*self.reach + world_size) % world_size - y = (neighbor.y + random.choice([1,-1])*self.reach + world_size) % world_size + distance = random.randrange(1, self.reach + 1) + x = (neighbor.x + random.choice([1,-1])*distance + world_size) % world_size + y = (neighbor.y + random.choice([1,-1])*distance + world_size) % world_size if world[x][y] is None: world[x][y] = neighbor world[neighbor.x][neighbor.y] = None neighbor.x = x neighbor.y = y pushed = pushed + 1 + if pushed > 0 : + self.fought_recently = True def forage(self, _): - if self.mature and self.food < self.greed*self.piggy: + def attempt_food_find(penalty): food_found = False attempts = 0 - while attempts < self.diligent and not food_found: + while attempts < self.diligent + self.skill and not food_found: food_roll = random.randrange(0, roll_max) - if food_roll < (self.luck + self.skill + self.wit): + if food_roll < self.skill*(self.luck + self.wit): food_found = True attempts = attempts + 1 if food_found: - luck_imapct = random.randrange(0, self.luck) + luck_imapct = random.randrange(1, self.luck + 1) found_ammount_found = luck_imapct*(self.skill*self.wit - attempts - 1) - self.food = self.food + found_ammount_found + if found_ammount_found > penalty: + self.food = self.food + found_ammount_found - penalty global finds; finds = finds + 1 elif self.joy > self.hunger and self.hunger < 0: self.joy = self.joy + self.hunger @@ -493,14 +521,20 @@ class LifeForm: self.joy = self.joy - self.hunger else: self.joy = 0 - + + if self.mature and self.food < self.greed*self.piggy: + attempt_food_find(0) + elif not self.mature and self.lifetime >= self.mature_age - self.luck and \ + self.hunger < 0 or self.food < self.piggy: + attempt_food_find(self.mature_age - self.luck - self.lifetime) + def eat(self, _): if self.food > self.piggy + self.extra_pregnancy_food: self.food = self.food - self.piggy - self.extra_pregnancy_food - if self.energy + self.piggy + self.luck <= max_energy: - self.energy = self.energy + self.piggy + self.luck + if self.health + self.piggy + self.luck <= max_health: + self.health = self.health + self.piggy + self.luck else: - self.energy = max_energy + self.luck + self.health = max_health + self.luck else: self.hunger = self.hunger + self.food - self.piggy - self.extra_pregnancy_food self.food = 0 @@ -513,7 +547,7 @@ class LifeForm: else: self.food = self.food + self.hunger self.hunger = 0 - self.energy = self.energy + self.hunger + self.health = self.health + self.hunger joy_mods = [self.hunger, self.luck] joy_mods.sort() self.joy = self.joy + random.randrange(joy_mods[0], joy_mods[1] + 1) @@ -522,7 +556,7 @@ class LifeForm: if satisfaction_roll < self.luck: self.joy = self.joy + random.randrange(0, self.luck) - def mingle(self, _): + def interact(self, _): neighbors = [world[i][j] for i in range(self.x - self.reach, self.x + self.reach + 1) for j in range(self.y - self.reach, self.y + self.reach + 1) @@ -536,9 +570,11 @@ class LifeForm: if self.hunger < 0: neighbor._give(self, -1*self.hunger) trade_requests = trade_requests + 1 + self.gave_recently = True if self.food < self.greed*self.piggy: neighbor._give(self, self.greed*self.piggy - self.food) trade_requests = trade_requests + 1 + self.gave_recently = True # trade if self.joy > neighbor.joy and \ @@ -547,20 +583,22 @@ class LifeForm: self.food < self.greed*self.piggy: self._trade(neighbor, self.greed*self.piggy - self.food) trade_requests = trade_requests + 1 + self.trade_recently = True # steal if trade_requests < self.diligent and \ - (self.hunger < 0 or self.food < round(self.greed*self.piggy/2) and \ - self.energy > 0 and neighbor.energy > 0): + (self.hunger < 0 or self.food < self.greed*self.piggy//2 and \ + self.health > 0 and neighbor.health > 0): self._take(neighbor, self.greed*self.piggy - self.food) trade_requests = trade_requests + 1 recent_fights = recent_fights + 1 + self.fought_recently = True # attack/jealousy if self.joy < neighbor.joy and \ - self.energy > neighbor.energy and \ - self.energy > 0 and \ - neighbor.energy > 0 and \ + self.health > neighbor.health and \ + self.health > 0 and \ + neighbor.health > 0 and \ not self.pregnant and \ not neighbor.pregnant and \ self.hostility > recent_fights and \ @@ -588,9 +626,9 @@ class LifeForm: elif grievances[0] == "hunger": self._take(neighbor, (-1*self.hunger) - (-1*neighbor.hunger) + neighbor.joy - self.joy) elif grievances[0] == "beauty": - delta_beauty = neighbor.beauty - self.beauty - self.energy = self.energy - delta_beauty - self.joy = self.joy + round(delta_beauty/2) + delta_beauty = neighbor.beauty + neighbor.scars - (self.beauty + neighbor.luck + self.scars) + self.health = self.health - delta_beauty + self.joy = self.joy + delta_beauty//2 if -1*neighbor.scars <= neighbor.beauty: neighbor.scars = neighbor.scars - delta_beauty else: @@ -601,8 +639,8 @@ class LifeForm: neighbor.joy = 0 elif grievances[0] == "wit": delta_wit = neighbor.wit - self.wit - self.energy = self.energy - delta_wit - self.joy = self.joy + round(delta_wit/2) + self.health = self.health - delta_wit + self.joy = self.joy + delta_wit//2 neighbor.wit = neighbor.wit - delta_wit if neighbor.joy > delta_wit: neighbor.joy = neighbor.joy - delta_wit @@ -610,8 +648,8 @@ class LifeForm: neighbor.joy = 0 elif grievances[0] == "luck": delta_luck = neighbor.wit - self.wit - self.energy = self.energy - delta_luck - self.joy = self.joy + round(delta_luck/2) + self.health = self.health - delta_luck + self.joy = self.joy + delta_luck//2 if neighbor.joy > delta_luck: neighbor.joy = neighbor.joy - delta_luck else: @@ -629,11 +667,66 @@ class LifeForm: self.scars = -1*neighbor.luck recent_fights = recent_fights + 1 self.fights = self.fights + 1 + self.fought_recently = True # thanos clause - if len(alive_list)/(world_size*world_size) > (roll_max - self.hostility)/roll_max or\ - len(alive_list)/(world_size*world_size) < (self.hostility)/roll_max: - neighbor.energy = 0 - self.energy = 0 + if len(alive_list)//(world_size*world_size) > (roll_max - self.hostility)//roll_max or\ + len(alive_list)//(world_size*world_size) < (self.hostility)//roll_max: + neighbor.health = 0 + self.health = 0 + + # mingle + if neighbors.index(neighbor) < self.charm: + if neighbor.love == self.love: + self.joy = self.joy + self.luck*neighbor.luck + self._discern() + if neighbor.hate == self.hate: + self.joy = self.joy + self.luck*neighbor.luck + self._discern() + if getattr(neighbor, self.love) + neighbor.charm > getattr(self, self.love): + delta_love = getattr(neighbor, self.love) + neighbor.charm - getattr(self, self.love) + self.joy = self.joy + delta_love + neighbor.joy = neighbor.joy + delta_love//4 + self._discern() + if getattr(neighbor, self.hate) - neighbor.charm < getattr(self, self.hate): + delta_hate = getattr(neighbor, self.hate) - neighbor.charm + getattr(self, self.hate) + self.joy = self.joy + delta_hate + neighbor.joy = neighbor.joy + delta_hate//4 + self._discern() + + if neighbor.hate == self.love: + if neighbor.joy > self.luck*self.charm: + neighbor.joy = neighbor.joy - self.luck*self.charm + else: + neighbor.joy = 0 + + if self.joy > neighbor.luck*neighbor.charm: + self.joy = self.joy - neighbor.luck*neighbor.charm + else: + self.joy = 0 + if self.hate == neighbor.love: + if neighbor.joy > self.luck*self.charm: + neighbor.joy = neighbor.joy - self.luck*self.charm + else: + neighbor.joy = 0 + + if self.joy > neighbor.luck*neighbor.charm: + self.joy = self.joy - neighbor.luck*neighbor.charm + else: + self.joy = 0 + if getattr(neighbor, self.love) + neighbor.charm < getattr(self, self.love): + delta_love = getattr(self, self.love) - neighbor.charm - getattr(neighbor, self.love) + if neighbor.joy > delta_love: + neighbor.joy = neighbor.joy - delta_love + else: + neighbor.joy = 0 + self.joy = self.joy + delta_love//4 + if getattr(neighbor, self.hate) - neighbor.charm > getattr(self, self.hate): + delta_hate = getattr(neighbor, self.hate) - neighbor.charm + getattr(self, self.hate) + if neighbor.joy > delta_hate: + neighbor.joy = neighbor.joy - delta_hate + else: + neighbor.joy = 0 + self.joy = self.joy + delta_hate//4 # mate if ((self.male and not neighbor.male) or (neighbor.male and not self.male)) and \ @@ -643,21 +736,20 @@ class LifeForm: not self.pregnant and \ self.mature and \ neighbor.mature and \ - neighbor.energy + (neighbor.beauty + neighbor.scars)*neighbor.luck*neighbor.charm > self.energy: + neighbor.health + (neighbor.beauty + neighbor.scars)*neighbor.luck*neighbor.charm > self.health: self._mate(neighbor) def pregnancy(self, month): if not self.male and self.pregnant: if self.rounds_pregnant < self.gestation: self.rounds_pregnant = self.rounds_pregnant + 1 - self.extra_pregnancy_food = round(self.piggy*(self.rounds_pregnant/self.gestation)) + self.extra_pregnancy_food = self.piggy*(self.rounds_pregnant//self.gestation) else: maternal_genes = { "luck": self.luck, "diligent": self.diligent, "wit": self.wit, - "skill": self.skill, - "energy": self.energy, + "health": self.health, "speed": self.speed, "restless": self.restless, "gestation": self.gestation, @@ -695,7 +787,7 @@ class LifeForm: y=baby_place[1], id=last_id, male=xy, - food=round(self.food/2)+self.paternal_genes["food"], + food=self.food//2+self.paternal_genes["food"], mother_genes=maternal_genes, father_genes=self.paternal_genes, name=names.get_first_name(gender=gender_text), @@ -707,13 +799,13 @@ class LifeForm: ) child.parents.append(self) child.parents.append(self.baby_daddy) - self.food = round(self.food/2) + self.food = self.food//2 self.children.append(child) self.baby_daddy.children.append(child) world[local_x][local_y] = child alive_list.append(child) elif self.joy > 0: - self.joy = round(self.joy/2) # baby was lost + self.joy = self.joy//2 # baby was lost self.paternal_genes = {} self.rounds_pregnant = 0 self.pregnant = False @@ -722,20 +814,25 @@ class LifeForm: def age(self, month): if month > 0 and month % months_in_a_year == self.birth_month: self.lifetime = self.lifetime + 1 - self.mated_recently = False - age_roll = random.randrange(0, round(self.lifetime/months_in_a_year) + 1) + self.joy = self.joy + self.lifetime//(self.birth_month+1) # happy birthda...month + age_roll = random.randrange(0, self.lifetime//months_in_a_year + 1) if age_roll > self.luck: - self.energy = self.energy - self.lifetime + self.health = self.health - self.lifetime scar_heal_roll = random.randrange(0, roll_max) if self.scars < 0 and scar_heal_roll < self.luck: self.scars = self.scars + 1 maturity_offset = random.randrange(0, self.luck) if not self.mature and self.mature_age <= self.lifetime + maturity_offset: self.mature = True - if self.energy < 0 or (self.joy < 0 and -1*self.joy > self.luck): + if self.health < 0 or (self.joy < 0 and -1*self.joy > self.luck): self._die() # interaction methods + def _discern(self): + skill_up_roll = random.randrange(0, self.skill*self.skill + 1) + if self.luck + self.charm + self.wit > skill_up_roll: + self.skill = self.skill + 1 + def _give(self, target, ammount): global begs @@ -804,10 +901,10 @@ class LifeForm: self.joy = self.joy - joy_split def _take(self, target, ammount): - if self.energy + self.luck > target.energy + target.luck: - energy_delta = self.energy + self.luck - target.energy - target.luck - target.energy = target.energy - energy_delta - self.energy = self.energy - round(energy_delta/2) + if self.health + self.luck > target.health + target.luck: + health_delta = self.health + self.luck - target.health - target.luck + target.health = target.health - health_delta + self.health = self.health - health_delta//2 if target.joy > ammount - target.luck: target.joy = target.joy - ammount + target.luck @@ -821,9 +918,9 @@ class LifeForm: self.food = self.food + target.food target.food = 0 else: - energy_delta = target.energy + target.luck - self.energy - self.luck - target.energy = target.energy - round(energy_delta/2) - self.energy = self.energy - energy_delta + health_delta = target.health + target.luck - self.health - self.luck + target.health = target.health - health_delta//2 + self.health = self.health - health_delta if self.joy > ammount - self.luck: self.joy = self.joy - ammount + self.luck @@ -831,13 +928,13 @@ class LifeForm: self.joy = 0 if self.food > 0: - target.food = target.food + round(self.food/2) - self.food = round(self.food/2) + target.food = target.food + self.food//2 + self.food = self.food//2 self.fights = self.fights + 1 global thefts; thefts = thefts + 1 def _mate(self, target): - if self.energy + self.beauty + self.scars > target.beauty + target.scars + target.energy: + if self.health + self.beauty + self.scars > target.beauty + target.scars + target.health: self.joy = self.joy + abs(self.beauty - target.beauty) target.joy = target.joy + abs(target.beauty - self.beauty) if self.male and not target.male and not target.pregnant: @@ -847,8 +944,7 @@ class LifeForm: "luck": self.luck, "diligent": self.diligent, "wit": self.wit, - "skill": self.skill, - "energy": self.energy, + "health": self.health, "speed": self.speed, "restless": self.restless, "gestation": self.gestation, @@ -861,9 +957,9 @@ class LifeForm: "mature_age": self.mature_age, "reach": self.reach, "kinship": self.kinship, - "food": round(self.food/2) # This is not a property on the maternal list, daddy pays up front + "food": self.food//2 # This is not a property on the maternal list, daddy pays up front } - self.food = round(self.food/2) + self.food = self.food//2 target.baby_daddy = self elif target.male and not self.male and not self.pregnant: self.pregnant = True @@ -872,8 +968,7 @@ class LifeForm: "luck": target.luck, "diligent": target.diligent, "wit": target.wit, - "skill": target.skill, - "energy": target.energy, + "health": target.health, "speed": target.speed, "restless": target.restless, "gestation": target.gestation, @@ -886,50 +981,54 @@ class LifeForm: "mature_age": target.mature_age, "reach": target.reach, "kinship": target.kinship, - "food": round(target.food/2) # This is not a property on the maternal list, daddy pays up front + "food": target.food//2 # This is not a property on the maternal list, daddy pays up front } self.baby_daddy = target - target.food = round(target.food/2) - self.mated_recently = self.luck*self.greed > random.randrange(0, roll_max) + target.food = target.food//2 + self.mated_recently = self.luck + self.greed > random.randrange(0, self.luck*self.greed +1) else: self.joy = self.joy + self.beauty - target.beauty target.joy = target.joy + target.beauty - self.beauty # ["hostility", "piggy", "greed", "miserly", "lifetime"] drawn_msgs = [ - [("Blocks in order from Top Left to Bottom Right:", default_font_color), - ("Top Far Left (FL): Food", default_font_color), - ("Top Left Center (LC): Energy", default_font_color), - ("Top Center Left (CL): Joy", default_font_color), - ("Top Center Right (CR): Love", default_font_color), - ("Top Right Center (RC): Hate", default_font_color), - ("Top Far Right (FR): Heart", default_font_color), - ("Bot Far Left (FL): Hunger", default_font_color), - ("Bot Left Center (LC): Gender", default_font_color), - ("Bot Center Left (CL): Age", default_font_color), - ("Bot Center Right (CR): Luck", default_font_color), - ("Bot Right Center (RC): Beauty", default_font_color), - ("Bot Far Right (FR): Key/Msg", default_font_color)], + [("Blocks from Top Left to Bottom Right:", default_font_color), + ("Top Far Left (FL): Food", default_font_color), + ("Top Left Center (LC): Health", default_font_color), + ("Top Center Left (CL): Joy", default_font_color), + ("Top Center Right (CR) Love", default_font_color), + ("Top Right Center (RC): Hate", default_font_color), + ("Top Far Right (FR): Heart", default_font_color), + ("Bot Far Left (FL): Hunger", default_font_color), + ("Bot Left Center (LC): Gender", default_font_color), + ("Bot Center Left (CL): Age", default_font_color), + ("Bot Center Right (CR): Luck", default_font_color), + ("Bot Right Center (RC): Beauty + Scars", default_font_color), + ("Bot Far Right (FR): Key/Msg", default_font_color)], [("Food Block (Top FL) Key:", default_font_color), ("Low: Food < Greed*Piggy/Luck", LifeFormColors.Food.low), ("Medium: Inbetween", LifeFormColors.Food.medium), ("High: Food < Greed*Piggy", LifeFormColors.Food.high)], - [("Hunger Block (Bot FL) Key:", default_font_color), - ("High: Hunger < -Luck", LifeFormColors.Hunger.high), - ("Medium: -Luck <= Energy < 0", LifeFormColors.Hunger.medium), - ("Low: Hunger >= 0", LifeFormColors.Hunger.low)], - [("Energy Block (Top LC) Key:", default_font_color), - ("Excess: Energy > 1000", LifeFormColors.Energy.excess), - ("High: 800 < Energy <= 1000", LifeFormColors.Energy.high), - ("Medium: 500 < Energy <= 800", LifeFormColors.Energy.medium), - ("Low: 250 < Energy <= 500", LifeFormColors.Energy.low), - ("Dying: Energy <= 250", LifeFormColors.Energy.dying)], + [("Skill Block (Bot FL) Key:", default_font_color), + ("Expert: Skill > 60", LifeFormColors.Skill.expert), + ("Proficient: 45 < Skill =< 60", LifeFormColors.Skill.proficient), + ("Competent: 30 < Skill =< 45", LifeFormColors.Skill.competent), + ("Beginner: 15 < Skill =< 30", LifeFormColors.Skill.beginner), + ("Novice: Skill =< 15", LifeFormColors.Skill.novice), + ("Apprentice: Immature & Age > Adult - Luck", LifeFormColors.Skill.apprentice), + ("Child: Immature", LifeFormColors.Skill.child)], + [("Health Block (Top LC) Key:", default_font_color), + ("Excess: Health > 1000", LifeFormColors.Health.excess), + ("High: 750 < Health <= 1000", LifeFormColors.Health.high), + ("Medium: 400 < Health <= 750", LifeFormColors.Health.medium), + ("Low: 100 < Health <= 400", LifeFormColors.Health.low), + ("Dying: Health <= 100", LifeFormColors.Health.dying)], [("Joy Block (Top CL) Key:", default_font_color), ("Tops: Joy > 1000", LifeFormColors.Joy.tops), ("Excess: 650 < Joy <= 1000", LifeFormColors.Joy.excess), ("High: 350 < Joy <= 650", LifeFormColors.Joy.high), ("Medium: 100 < Joy <= 350", LifeFormColors.Joy.medium), ("Low: 50 < Joy <= 100", LifeFormColors.Joy.low), - ("Dying: Joy <= 50", LifeFormColors.Joy.dying)], + ("Dying: Joy <= 25", LifeFormColors.Joy.dying)], [("Love Block (Top CR) Key:", default_font_color), ("Wit", LifeFormColors.Loves.wit), ("Luck", LifeFormColors.Loves.luck), @@ -938,7 +1037,7 @@ drawn_msgs = [ ("Charm", LifeFormColors.Loves.charm), ("Beauty", LifeFormColors.Loves.beauty), ("Food", LifeFormColors.Loves.food), - ("Energy", LifeFormColors.Loves.energy), + ("Health", LifeFormColors.Loves.health), ("Joy", LifeFormColors.Loves.joy), ("Hostility", LifeFormColors.Loves.hostility), ("Kinship", LifeFormColors.Loves.kinship)], @@ -949,8 +1048,16 @@ drawn_msgs = [ ("Miserly", LifeFormColors.Hates.miserly), ("Lifetime", LifeFormColors.Hates.lifetime)], [("Heart Block (Top FR) Key:", default_font_color), - ("Love", LifeFormColors.Heart.love), - ("Hate", LifeFormColors.Heart.hate)], + ("Lover", LifeFormColors.Heart.lover), + ("Fighter", LifeFormColors.Heart.fighter), + ("Hater", LifeFormColors.Heart.hater), + ("Entrepreneur", LifeFormColors.Heart.entrepreneur), + ("Giver", LifeFormColors.Heart.giver), + ("Philantropist (GT)", LifeFormColors.Heart.give_trade), + ("Scammer (FT)", LifeFormColors.Heart.fight_trade), + ("Predator (GF)", LifeFormColors.Heart.give_fight), + ("Villian (GFT)", LifeFormColors.Heart.give_fight_trade), + ], [("Gender Block (Bot LC) Key:", default_font_color), ("Female Pregnancy Pre-Start", LifeFormColors.Gender.pregnant), ("Female Pregnancy Start", LifeFormColors.Gender.pregnant_round_1), @@ -966,41 +1073,41 @@ drawn_msgs = [ ("Ancient: 100 <= Age ", LifeFormColors.Lifetime.ancient)], [("Luck Block (Bot CR) Key:", default_font_color), (f"Excess: Luck > {luck_max_start}", LifeFormColors.Luck.excess), - (f"High: {luck_max_start} >= Luck > {round(3*(luck_max_start - luck_min_start)/4 + luck_min_start)}", LifeFormColors.Luck.high), - (f"Medium: {round(3*(luck_max_start - luck_min_start)/4 + luck_min_start)} >= Luck > {round((luck_max_start - luck_min_start)/2)}", LifeFormColors.Luck.medium), - (f"Low: {round((luck_max_start - luck_min_start)/2)} >= Luck > {round((luck_min_start - luck_max_start)/4 + luck_min_start)}", LifeFormColors.Luck.low), - (f"Dying: {round((luck_max_start - luck_min_start)/4 + luck_min_start)} >= Luck ", LifeFormColors.Luck.dying)], - [("Beauty Block (Bot RC) Key:", default_font_color), + (f"High: {luck_max_start} >= Luck > {3*(luck_max_start - luck_min_start)//4 + luck_min_start}", LifeFormColors.Luck.high), + (f"Medium: {3*(luck_max_start - luck_min_start)//4 + luck_min_start} >= Luck > {(luck_max_start - luck_min_start)//2}", LifeFormColors.Luck.medium), + (f"Low: {(luck_max_start - luck_min_start)//2} >= Luck > {(luck_min_start - luck_max_start)//4 + luck_min_start}", LifeFormColors.Luck.low), + (f"Dying: {(luck_max_start - luck_min_start)//4 + luck_min_start} >= Luck ", LifeFormColors.Luck.dying)], + [("Beauty + Scars Block (Bot RC) Key:", default_font_color), (f"Excess: Beauty > {beauty_max_start}", LifeFormColors.Beauty.excess), - (f"High: {beauty_max_start} >= Beauty > {round(3*(beauty_max_start - beauty_min_start)/4 + beauty_min_start)}", LifeFormColors.Beauty.high), - (f"Medium: {round(3*(beauty_max_start - beauty_min_start)/4 + beauty_min_start)} >= Beauty > {round((beauty_max_start - beauty_min_start)/2)}", LifeFormColors.Beauty.medium), - (f"Low: {round((beauty_max_start - beauty_min_start)/2)} >= Beauty > {round((beauty_min_start - beauty_max_start)/4 + beauty_min_start)}", LifeFormColors.Beauty.low), - (f"Dying: {round((beauty_max_start - beauty_min_start)/4 + beauty_min_start)} >= Beauty ", LifeFormColors.Beauty.dying)] + (f"High: {beauty_max_start} >= Beauty > {3*(beauty_max_start - beauty_min_start)//4 + beauty_min_start}", LifeFormColors.Beauty.high), + (f"Medium: {3*(beauty_max_start - beauty_min_start)//4 + beauty_min_start} >= Beauty > {(beauty_max_start - beauty_min_start)//2}", LifeFormColors.Beauty.medium), + (f"Low: {(beauty_max_start - beauty_min_start)//2} >= Beauty > {(beauty_min_start - beauty_max_start)//4 + beauty_min_start}", LifeFormColors.Beauty.low), + (f"Dying: {(beauty_max_start - beauty_min_start)//4 + beauty_min_start} >= Beauty ", LifeFormColors.Beauty.dying)] ] def print_world(month): - pygame.display.set_caption(f"LifeForms {int(month/months_in_a_year)}.{month % months_in_a_year + 1} {len(alive_list)}") + pygame.display.set_caption(f"LifeForms {month//months_in_a_year}.{month % months_in_a_year + 1} {len(alive_list)}") world_board.fill((0, 0, 0)) for x in range(world_size): for y in range(world_size): - if world[x][y] is not None: + if world[x][y] is not None: if world[x][y].food > world[x][y].greed*world[x][y].piggy: lifeform_food = LifeFormColors.Food.high - elif world[x][y].food < world[x][y].greed*world[x][y].piggy/world[x][y].luck: + elif world[x][y].food < world[x][y].greed*world[x][y].piggy//world[x][y].luck: lifeform_food = LifeFormColors.Food.low else: lifeform_food = LifeFormColors.Food.medium - if world[x][y].energy > 1000: - lifeform_energy = LifeFormColors.Energy.excess - elif world[x][y].energy > 800: - lifeform_energy = LifeFormColors.Energy.high - elif world[x][y].energy > 500: - lifeform_energy = LifeFormColors.Energy.medium - elif world[x][y].energy > 250: - lifeform_energy = LifeFormColors.Energy.low + if world[x][y].health > 1000: + lifeform_health = LifeFormColors.Health.excess + elif world[x][y].health > 750: + lifeform_health = LifeFormColors.Health.high + elif world[x][y].health > 400: + lifeform_health = LifeFormColors.Health.medium + elif world[x][y].health > 100: + lifeform_health = LifeFormColors.Health.low else: - lifeform_energy = LifeFormColors.Energy.dying + lifeform_health = LifeFormColors.Health.dying if world[x][y].joy > 1000: lifeform_joy = LifeFormColors.Joy.tops @@ -1010,15 +1117,29 @@ def print_world(month): lifeform_joy = LifeFormColors.Joy.high elif world[x][y].joy > 100: lifeform_joy = LifeFormColors.Joy.medium - elif world[x][y].joy > 50: + elif world[x][y].joy > 25: lifeform_joy = LifeFormColors.Joy.low else: lifeform_joy = LifeFormColors.Joy.dying - if world[x][y].hate_first: - lifeform_heart = LifeFormColors.Heart.hate + if world[x][y].fought_recently and world[x][y].gave_recently and world[x][y].trade_recently: + lifeform_heart = LifeFormColors.Heart.give_fight_trade + elif world[x][y].fought_recently and world[x][y].gave_recently: + lifeform_heart = LifeFormColors.Heart.give_fight + elif world[x][y].fought_recently and world[x][y].trade_recently: + lifeform_heart = LifeFormColors.Heart.fight_trade + elif world[x][y].gave_recently and world[x][y].trade_recently: + lifeform_heart = LifeFormColors.Heart.give_trade + elif world[x][y].gave_recently: + lifeform_heart = LifeFormColors.Heart.giver + elif world[x][y].trade_recently: + lifeform_heart = LifeFormColors.Heart.entrepreneur + elif world[x][y].fought_recently: + lifeform_heart = LifeFormColors.Heart.fighter + elif world[x][y].hate_first: + lifeform_heart = LifeFormColors.Heart.hater else: - lifeform_heart = LifeFormColors.Heart.love + lifeform_heart = LifeFormColors.Heart.lover if world[x][y].rounds_pregnant == 1: lifeform_gender = LifeFormColors.Gender.pregnant_round_1 @@ -1066,38 +1187,46 @@ def print_world(month): if world[x][y].luck > luck_max_start: lifeform_luck = LifeFormColors.Luck.excess - elif world[x][y].luck > 3*(luck_max_start - luck_min_start)/4 + luck_min_start: + elif world[x][y].luck > 3*(luck_max_start - luck_min_start)//4 + luck_min_start: lifeform_luck = LifeFormColors.Luck.high - elif world[x][y].luck > (luck_min_start + luck_max_start)/2: + elif world[x][y].luck > (luck_min_start + luck_max_start)//2: lifeform_luck = LifeFormColors.Luck.medium - elif world[x][y].luck > (luck_max_start - luck_min_start)/4 + luck_min_start: + elif world[x][y].luck > (luck_max_start - luck_min_start)//4 + luck_min_start: lifeform_luck = LifeFormColors.Luck.low else: lifeform_luck = LifeFormColors.Luck.dying - if world[x][y].beauty > beauty_max_start: + if world[x][y].beauty + world[x][y].scars > beauty_max_start: lifeform_beauty = LifeFormColors.Beauty.excess - elif world[x][y].beauty > 3*(beauty_max_start - beauty_min_start)/4 + beauty_min_start: + elif world[x][y].beauty + world[x][y].scars > 3*(beauty_max_start - beauty_min_start)//4 + beauty_min_start: lifeform_beauty = LifeFormColors.Beauty.high - elif world[x][y].beauty > (beauty_min_start + beauty_max_start)/2: + elif world[x][y].beauty + world[x][y].scars > (beauty_min_start + beauty_max_start)//2: lifeform_beauty = LifeFormColors.Beauty.medium - elif world[x][y].beauty > (beauty_max_start - beauty_min_start)/4 + beauty_min_start: + elif world[x][y].beauty + world[x][y].scars > (beauty_max_start - beauty_min_start)//4 + beauty_min_start: lifeform_beauty = LifeFormColors.Beauty.low else: lifeform_beauty = LifeFormColors.Beauty.dying - if world[x][y].hunger < -1*world[x][y].luck: - lifeform_hunger = LifeFormColors.Food.high - elif world[x][y].food >= 0: - lifeform_hunger = LifeFormColors.Hunger.low + if world[x][y].skill > 60 and world[x][y].mature: + lifeform_skill = LifeFormColors.Skill.expert + elif world[x][y].skill > 45 and world[x][y].mature: + lifeform_skill = LifeFormColors.Skill.proficient + elif world[x][y].skill > 30 and world[x][y].mature: + lifeform_skill = LifeFormColors.Skill.competent + elif world[x][y].skill > 15 and world[x][y].mature: + lifeform_skill = LifeFormColors.Skill.beginner + elif world[x][y].mature: + lifeform_skill = LifeFormColors.Skill.novice + elif world[x][y].lifetime >= world[x][y].mature_age - world[x][y].luck: + lifeform_skill = LifeFormColors.Skill.apprentice else: - lifeform_hunger = LifeFormColors.Food.medium + lifeform_skill = LifeFormColors.Skill.child lifeform_love = getattr(LifeFormColors.Loves, world[x][y].love) lifeform_hate = getattr(LifeFormColors.Hates, world[x][y].hate) pygame.draw.rect(world_board, lifeform_food, (x*lifeform_draw_size + 0*(world_size*lifeform_draw_size + 1), y*lifeform_draw_size, lifeform_draw_size, lifeform_draw_size)) pygame.draw.rect(world_board, (255,255,255), (1*(world_size*lifeform_draw_size + 1) - 1, 0, 1, world_size*lifeform_draw_size)) - pygame.draw.rect(world_board, lifeform_energy, (x*lifeform_draw_size + 1*(world_size*lifeform_draw_size + 1), y*lifeform_draw_size, lifeform_draw_size, lifeform_draw_size)) + pygame.draw.rect(world_board, lifeform_health, (x*lifeform_draw_size + 1*(world_size*lifeform_draw_size + 1), y*lifeform_draw_size, lifeform_draw_size, lifeform_draw_size)) pygame.draw.rect(world_board, (255,255,255), (2*(world_size*lifeform_draw_size + 1) - 1, 0, 1, world_size*lifeform_draw_size)) pygame.draw.rect(world_board, lifeform_joy, (x*lifeform_draw_size + 2*(world_size*lifeform_draw_size + 1), y*lifeform_draw_size, lifeform_draw_size, lifeform_draw_size)) pygame.draw.rect(world_board, (255,255,255), (3*(world_size*lifeform_draw_size + 1) - 1, 0, 1, world_size*lifeform_draw_size)) @@ -1109,7 +1238,7 @@ def print_world(month): pygame.draw.rect(world_board, (255,255,255), (0, 1*(world_size*lifeform_draw_size + 1), world_size*lifeform_draw_size*6 + 5, 1)) - pygame.draw.rect(world_board, lifeform_hunger, (x*lifeform_draw_size + 0*(world_size*lifeform_draw_size + 1), y*lifeform_draw_size + 1*(world_size*lifeform_draw_size + 1), lifeform_draw_size, lifeform_draw_size)) + pygame.draw.rect(world_board, lifeform_skill, (x*lifeform_draw_size + 0*(world_size*lifeform_draw_size + 1), y*lifeform_draw_size + 1*(world_size*lifeform_draw_size + 1), lifeform_draw_size, lifeform_draw_size)) pygame.draw.rect(world_board, (255,255,255), (1*(world_size*lifeform_draw_size + 1) - 1, 1*(world_size*lifeform_draw_size + 1), 1, world_size*lifeform_draw_size)) pygame.draw.rect(world_board, lifeform_gender, (x*lifeform_draw_size + 1*(world_size*lifeform_draw_size + 1), y*lifeform_draw_size + 1*(world_size*lifeform_draw_size + 1), lifeform_draw_size, lifeform_draw_size)) pygame.draw.rect(world_board, (255,255,255), (2*(world_size*lifeform_draw_size + 1) - 1, 1*(world_size*lifeform_draw_size + 1), 1, world_size*lifeform_draw_size)) @@ -1121,13 +1250,20 @@ def print_world(month): pygame.draw.rect(world_board, (255,255,255), (5*(world_size*lifeform_draw_size + 1) - 1, 1*(world_size*lifeform_draw_size + 1), 1, world_size*lifeform_draw_size)) line_counter = 0 + text = font.render(f"Alive: {len(alive_list)}", True, default_font_color) + world_board.blit(text, (5*(world_size*lifeform_draw_size + 1) + font_size//2, 1*(world_size*lifeform_draw_size + 1) + line_counter*font_size + font_size//2)) + line_counter = line_counter + 1 for msg in drawn_msgs[month % len(drawn_msgs)]: text = font.render(msg[0], True, msg[1]) - world_board.blit(text, (5*(world_size*lifeform_draw_size + 1) + font_size/2, 1*(world_size*lifeform_draw_size + 1) + line_counter*font_size + font_size/2)) + world_board.blit(text, (5*(world_size*lifeform_draw_size + 1) + font_size//2, 1*(world_size*lifeform_draw_size + 1) + line_counter*font_size + font_size//2)) line_counter = line_counter + 1 pygame.display.update() if save_all_drawings or (save_some_drawings > 0 and month % save_some_drawings == 0): - pygame.image.save(world_board, os.path.join(os.path.dirname(os.path.realpath(__file__)), f"sim_{run_id}_{int(month/months_in_a_year)}.{month % months_in_a_year + 1}.jpg")) + try: + pygame.image.save(world_board, os.path.join(run_path, f"sim_{run_id}_{month//months_in_a_year}.{month % months_in_a_year + 1}.jpg")) + except: + # Fucking Windows 98 + pass for creation in range(genesis_count): local_x = random.randrange(0, world_size) @@ -1146,7 +1282,7 @@ for creation in range(genesis_count): luck=random.randrange(luck_min_start, luck_max_start), diligent=random.randrange(diligent_min_start, diligent_max_start), wit=random.randrange(wit_min_start, wit_max_start), - energy=random.randrange(min_energy, max_energy), + health=random.randrange(min_health, max_health), lifetime=random.randrange(lifetime_min_start, lifetime_max_start), speed=random.randrange(speed_min_start, speed_max_start), restless=random.randrange(restless_min_start, restless_max_start), @@ -1174,7 +1310,7 @@ for creation in range(genesis_count): last_id = creation month = 0 -detail_csv_file.write("date,name,family,x,y,lifetime,energy,luck,diligent,skill,wit,speed,restless,mature," +detail_csv_file.write("date,name,family,x,y,lifetime,health,luck,diligent,skill,wit,speed,restless,mature," "mature_age,male,pregnant,gestation,birth_month,hunger,piggy,food,greed,joy,hostility," "miserly,charm,beauty,reach,kinship,love,hate,hate_first,parent_0_name,parent_0_family," "parent_1_name,parent_1_family,children_count,id,fights,scars,alive,begs,gifts,thefts,finds") @@ -1185,13 +1321,13 @@ while month < apocalypse and len(alive_list) < world_size*world_size: if draw_world: print_world(month) if log_details: - output = f"\n{int(month/months_in_a_year)}.{month % months_in_a_year + 1}," + output = f"\n{month//months_in_a_year}.{month % months_in_a_year + 1}," output = f"{output}{lifeform.name}," output = f"{output}{lifeform.family}," output = f"{output}{lifeform.x}," output = f"{output}{lifeform.y}," output = f"{output}{lifeform.lifetime}," - output = f"{output}{lifeform.energy}," + output = f"{output}{lifeform.health}," output = f"{output}{lifeform.luck}," output = f"{output}{lifeform.diligent}," output = f"{output}{lifeform.skill},"