Files
tamagotchi_colony/kinggotchi.py
2015-08-25 19:05:13 +02:00

42 lines
1.1 KiB
Python

#!/usr/bin/python
# -*- coding: utf-8 -*-
from config import *
import names
class Kinggotchi:
myvillages = []
name = ''
def __init__(self):
self.name = names.get_last_name()
def add_village(self, mayor):
self.myvillages.append(mayor)
def show_kingdom(self):
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