diff --git a/cli.py b/cli.py index f346324..799fabf 100644 --- a/cli.py +++ b/cli.py @@ -20,7 +20,7 @@ class cursesUI: self.villagenr = 0 self.percentage = True self.running = True - self.paused = start_paused + self.paused = START_PAUSED self.stdscr = curses.initscr() curses.noecho() @@ -31,7 +31,7 @@ class cursesUI: height, width = self.stdscr.getmaxyx() self.win = curses.newpad(16383, width) - self.king.createKingdom(startNrVillages) + self.king.createKingdom(STARTNR_VILLAGES) while self.running: self.build_screen(self.king, self.ticks) @@ -79,7 +79,7 @@ class cursesUI: if not self.kingdomview: self.percentage = not self.percentage elif key < 0: - time.sleep(ticklenght) + time.sleep(TICKLENGHT) if not self.running: curses.endwin() diff --git a/config.py b/config.py index e55549e..6614c6e 100644 --- a/config.py +++ b/config.py @@ -2,17 +2,17 @@ # -*- coding: utf-8 -*- # Define if simulation should be started paused or running -start_paused = True +START_PAUSED = True # The lenght of one game cycle in milliseconds -ticklenght = 0.001 +TICKLENGHT = 0.001 # Controls if Tamagotchi stats are shown in absolute vlaues or precentage (Possible values: True/False) -show_pct = True +SHOW_PTC = True # Number of Tamagotchis to be created at the start of the simulation -startnr = 60 -startNrVillages = 50 +STARTNR = 60 +STARTNR_VILLAGES = 50 # If the value of a Tamagotchis stats drops below this he will be fed/washed/etc # Synatx [Hunger, Hygiene, Happiness] -interventionPoints = [50, 50, 50] +INTERVENTION_POINTS = [50, 50, 50] # 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 @@ -20,15 +20,15 @@ washing_point = 50 # If the happiness stat falls below this level Tamagotchis can be played with play_point = 50 # When new Tamagotchis are created their stats will be be created randomly between these. -statrange = [100, 200] +STATRANGE = [100, 200] # Tamagotchis decay at a set rate per tick. The value of decay is randomly chosen between these two. -decay = [1, 3] +DECAY = [1, 3] # These two define how long it takes a Tamagotchi to perform work (preparing food/washing someone/playing with someone) # The value is choosen randomly between these two. Obviously a lower number is better. -workpower = [3, 6] +WORKPOWER = [3, 6] # This defines the bounds of how much a Tamagotchi can recover when eating/sleeping/playing etc. -recovery = [10, 20] +RECOVERY = [10, 20] # Defines the range in witch the lifetime of Tamagotichs will be created in ticks -life = [2000, 3000] +LIFE = [2000, 3000] diff --git a/kinggotchi.py b/kinggotchi.py index 2bf138c..ff3231b 100644 --- a/kinggotchi.py +++ b/kinggotchi.py @@ -42,5 +42,5 @@ class Kinggotchi: def createKingdom(self, startvillages): for _ in itertools.repeat(None, startvillages): - self.add_village(Mayorgotchi(Util().make_list_of_Tamagotchis(startnr))) + self.add_village(Mayorgotchi(Util().make_list_of_Tamagotchis(STARTNR))) diff --git a/mayorgotchi.py b/mayorgotchi.py index ba61958..43785c8 100644 --- a/mayorgotchi.py +++ b/mayorgotchi.py @@ -23,13 +23,13 @@ class Mayorgotchi: self.graveyard += 1 self.mygotchis.remove(n) - def give_status(self,show_pct): + def give_status(self,SHOW_PTC): result = "Town: " + self.name + "\n" result += "Population: " + str(len(self.mygotchis)) + " " result += "Graveyard: " + str(self.graveyard) + " " result += "Eggs: " + str(len(self.myeggs)) + "\n\n" for n in self.mygotchis: - if show_pct: + if SHOW_PTC: result += n.status_pct() else: result += n.status_abs() diff --git a/util.py b/util.py index 3078133..4732b55 100644 --- a/util.py +++ b/util.py @@ -9,16 +9,17 @@ import os class Util: def make_Tamagotchi(self): name = self.generateName() - hunger = random.randrange(statrange[0],statrange[1],1) - happiness = random.randrange(statrange[0],statrange[1],1) - hygiene = random.randrange(statrange[0],statrange[1],1) - sleep = random.randrange(statrange[0],statrange[1],1) - decayspeed = random.randrange(decay[0],decay[1],1) - potential = random.randrange(workpower[0], workpower[1],1) - recoveryspeed = random.randrange(recovery[0], recovery[1], 1) - lifetime = random.randrange(life[0], life[1], 1) + hunger = random.randrange(STATRANGE[0],STATRANGE[1],1) + happiness = random.randrange(STATRANGE[0],STATRANGE[1],1) + hygiene = random.randrange(STATRANGE[0],STATRANGE[1],1) + sleep = random.randrange(STATRANGE[0],STATRANGE[1],1) + decayspeed = random.randrange(DECAY[0],DECAY[1],1) + potential = random.randrange(WORKPOWER[0], WORKPOWER[1],1) + recoveryspeed = random.randrange(RECOVERY[0], RECOVERY[1], 1) + lifetime = random.randrange(LIFE[0], LIFE[1], 1) - return Tamagotchi(name,hunger,happiness,hygiene,sleep,decayspeed,potential,recoveryspeed,lifetime) + return Tamagotchi(name, hunger, happiness, hygiene, sleep, decayspeed, + potential, recoveryspeed, lifetime) def make_list_of_Tamagotchis(self, number): tmp = []