new overview for mayors

This commit is contained in:
luxick
2015-08-06 12:45:55 +02:00
parent 4785358bf5
commit 922a15bf59
3 changed files with 40 additions and 5 deletions

View File

@@ -29,6 +29,40 @@ class Mayorgotchi:
result += n.status_abs()
return result
def give_overview(self):
result = 'I am Mayorgotchi ' + self.name + '.\nThere are ' + str(len(self.mygotchis)) + ' Tamagotchis in my Village\nThere are ' + str(self.graveyard) + ' Tamagotchis in the graveyard.\nOccupation in my Village:\n'
tmp = self.get_status_list()
result += 'Idle:{0:5} Eating:{1:5} Sleeping:{2:5} Bathing:{3:5} Playing:{4:5} Working:{5:5}\n'.format(str(len(tmp[0])), str(len(tmp[1])), str(len(tmp[2])), str(len(tmp[3])), str(len(tmp[4])), str(len(tmp[5])))
return result
def get_status_list(self):
# A list containing lists of Tamagotchis and thier statuses
# 0 = Idle
# 1 = Eating
# 2 = Sleeping
# 3 = Bathing
# 4 = Playing
# 5 = Working
result = [[] for x in xrange(6)]
for n in self.mygotchis:
if n.status is 'Idle':
result[0].append(n)
if n.status is 'Eating':
result[1].append(n)
if n.status is 'Sleeping':
result[2].append(n)
if n.status is 'Bathing':
result[3].append(n)
if n.status is 'Playing':
result[4].append(n)
if n.status is 'Working':
result[5].append(n)
return result
def get_free(self):
freegotchis = []
for n in self.mygotchis: