diff --git a/config.py b/config.py index 4ef9ee0..3a17f3e 100644 --- a/config.py +++ b/config.py @@ -2,8 +2,16 @@ # The lenght of one game cycle in milliseconds ticklenght = 0.1 +# Number of Tamagotchis to be created at the start of the simulation +startnr = 50 # The amount of points a Tamagotchi loses per tick decayaspeed = 1 +# If the hunger stat falls below this level Tamagotchis can be fed +feeding_point = 50 +# If the hygiene stat falls below this level Tamagotchis can be washed +washing_point = 50 +# If the happiness stat falls below this level Tamagotchis can be played with +play_point = 50 # Controls if Tamagotchi stats are shown in absolute vlaues or precentage (Possible values: True/False) show_pct = True # When new Tamagotchis are created their stats will be be created randomly between these. diff --git a/config.pyc b/config.pyc index 024e5cf..c0fade4 100644 Binary files a/config.pyc and b/config.pyc differ diff --git a/mayorgotchi.py b/mayorgotchi.py index f284da2..23d18f7 100644 --- a/mayorgotchi.py +++ b/mayorgotchi.py @@ -3,6 +3,7 @@ from tamagotchi import Tamagotchi import names import random +from config import * class Mayorgotchi: mygotchis = [] @@ -41,13 +42,13 @@ class Mayorgotchi: def get_hungry(self): for n in self.mygotchis: if n.status is 'Idle': - if n.hunger[0] <= 20: + if n.hunger[0] <= feeding_point: return n def get_dirty(self): dirties = [] for n in self.mygotchis: - if n.hygiene[0] <= 20: + if n.hygiene[0] <= washing_point: dirties.append(n) if len(dirties) > 0: return dirties[random.randrange(0,len(dirties),1)] @@ -58,7 +59,7 @@ class Mayorgotchi: unhappies = [] result = [] for n in self.mygotchis: - if n.happiness[0] <= 20: + if n.happiness[0] <= play_point: unhappies.append(n) if len(unhappies) > 0: return unhappies[random.randrange(0,len(unhappies), 1)] diff --git a/mayorgotchi.pyc b/mayorgotchi.pyc index 23a75d3..bf8ca5b 100644 Binary files a/mayorgotchi.pyc and b/mayorgotchi.pyc differ diff --git a/test.py b/test.py index fda71a8..94db8ac 100644 --- a/test.py +++ b/test.py @@ -6,13 +6,11 @@ from config import * import time import curses - # Temporary test section list = [] ticks = 0 - -for n in range(0,50): +for n in range(0,startnr): list.append(Util().make_Tamagotchi()) mayor = Mayorgotchi(list)