more variables in config

This commit is contained in:
luxick
2015-07-26 23:13:02 +02:00
parent ebd649e7a8
commit 0f4cc5ed33
5 changed files with 13 additions and 6 deletions

View File

@@ -2,8 +2,16 @@
# The lenght of one game cycle in milliseconds # The lenght of one game cycle in milliseconds
ticklenght = 0.1 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 # The amount of points a Tamagotchi loses per tick
decayaspeed = 1 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) # Controls if Tamagotchi stats are shown in absolute vlaues or precentage (Possible values: True/False)
show_pct = True show_pct = True
# When new Tamagotchis are created their stats will be be created randomly between these. # When new Tamagotchis are created their stats will be be created randomly between these.

Binary file not shown.

View File

@@ -3,6 +3,7 @@
from tamagotchi import Tamagotchi from tamagotchi import Tamagotchi
import names import names
import random import random
from config import *
class Mayorgotchi: class Mayorgotchi:
mygotchis = [] mygotchis = []
@@ -41,13 +42,13 @@ class Mayorgotchi:
def get_hungry(self): def get_hungry(self):
for n in self.mygotchis: for n in self.mygotchis:
if n.status is 'Idle': if n.status is 'Idle':
if n.hunger[0] <= 20: if n.hunger[0] <= feeding_point:
return n return n
def get_dirty(self): def get_dirty(self):
dirties = [] dirties = []
for n in self.mygotchis: for n in self.mygotchis:
if n.hygiene[0] <= 20: if n.hygiene[0] <= washing_point:
dirties.append(n) dirties.append(n)
if len(dirties) > 0: if len(dirties) > 0:
return dirties[random.randrange(0,len(dirties),1)] return dirties[random.randrange(0,len(dirties),1)]
@@ -58,7 +59,7 @@ class Mayorgotchi:
unhappies = [] unhappies = []
result = [] result = []
for n in self.mygotchis: for n in self.mygotchis:
if n.happiness[0] <= 20: if n.happiness[0] <= play_point:
unhappies.append(n) unhappies.append(n)
if len(unhappies) > 0: if len(unhappies) > 0:
return unhappies[random.randrange(0,len(unhappies), 1)] return unhappies[random.randrange(0,len(unhappies), 1)]

Binary file not shown.

View File

@@ -6,13 +6,11 @@ from config import *
import time import time
import curses import curses
# Temporary test section # Temporary test section
list = [] list = []
ticks = 0 ticks = 0
for n in range(0,startnr):
for n in range(0,50):
list.append(Util().make_Tamagotchi()) list.append(Util().make_Tamagotchi())
mayor = Mayorgotchi(list) mayor = Mayorgotchi(list)