added Kinggotchi, multiple Villages in Kingdom

This commit is contained in:
luxick
2015-08-23 15:35:54 +02:00
parent f6d1abe23a
commit 15983586fc
3 changed files with 37 additions and 11 deletions

View File

@@ -16,5 +16,28 @@ class Kinggotchi:
self.myvillages.append(mayor)
def show_kingdom(self):
result = 'I am Kinggotchi '+str(self.name)+'.\nThese are the '+str(len(self.myvillages))+' Villages in my Kingdom:\n'
result = 'I am Kinggotchi '+str(self.name)+'.\nIn my Kingdom live '+str(self.all_tamagotchis())+' Tamagotichs.\nIn my Kingdom '+str(self.all_dead())+' Tamagotchis have died so far.\n\nThese are the '+str(len(self.myvillages))+' Villages in my Kingdom:\n'
for n in self.myvillages:
result += '-------------------------------------------------------------------------------\n'
result += n.give_overview()
return result
def step(self):
for n in self.myvillages:
n.step()
def all_tamagotchis(self):
result = 0
for n in self.myvillages:
result += len(n.mygotchis)
return result
def all_dead(self):
result = 0
for n in self.myvillages:
result += n.graveyard
return result