diff --git a/virtupet/Pudgi.py b/virtupet/Pudgi.py index e0ae1d9..5f74191 100644 --- a/virtupet/Pudgi.py +++ b/virtupet/Pudgi.py @@ -69,7 +69,9 @@ def __init__(self, parents=None, load_file=None): # ------- general data ------- self.known_decisions = self.json_object["known_decisions"] self.age = self.json_object["age"] - self.lifespan = random.randint(540, 660) # approximately 10 minute irl lifespan + + minute = 30*60 + self.lifespan = random.randint(14*minute, 16*minute) # 10 +-1 minute irl lifespan # TODO move this so it only happens upon creation of new Pudgi. Load pudgi should grab json attributes self.splice_dna() @@ -146,7 +148,7 @@ def decode_behavior(self, chromosomes): else: number = beta[1:] - bin_num = int(''.join(map(str, number)), base=2) #bin_num is the actual number out of 63 + bin_num = int(''.join(map(str, number)), base=2) # bin_num is the actual number out of 63 self.weights[key] = 1 / (bin_num + 1) def decode_color(self, chromosomes): @@ -365,12 +367,17 @@ def select_parents(active_agent_list): if len(high_happiness) >= 2: parent01 = high_happiness.pop() parent02 = high_happiness.pop() - if random.random() <= 0.6: + logger.logging.info(parent01.name + " and " + parent02.name + " are attempting to have a child.") + if random.random() <= 0.5: parents.append((parent01.uid, parent02.uid)) parent01.happiness = 2.0 - parent01.vitality -= 4 + parent01.vitality -= 3 parent02.happiness = 2.0 - parent02.vitality -= 4 + parent02.vitality -= 3 + else: + logger.logging.info("They will have to try again.") + parent01.happiness = 5.0 + parent02.happiness = 5.0 return parents @@ -397,8 +404,8 @@ def make_decision(self): chance_waking = -1 chance_sleeping = -1 # check vitality for sleepiness (using fuzzy logic) - low = 1 - high = 10 + low = 2.5 + high = 9 if vitality <= low: chance_waking = 0 chance_sleeping = 1 diff --git a/virtupet/main.py b/virtupet/main.py index ce87f62..b6b7213 100644 --- a/virtupet/main.py +++ b/virtupet/main.py @@ -119,6 +119,9 @@ def main(): logger.logging.info("<<<---" + pudgi.name + " died of old age--->>>") logger.logging.info("Death Count: " + str(death_count)) + else: + pudgi.age += 1 + # logger.logging.info(colored(pudgi.name + " died of old age", "red")) if pudgi.sleeping: movement[pudgi.name]["direction"] = "S"