def __init__(self, city, attrs=None):
    self.name = ('Person_%04d' % len(city.residents))
    city.residents.append(self)
    self.children = list()
    self.father = None
    self.mother = None
    self.spouse = None
    self.company = None
    if (not attrs):
        self.is_male = (True if (random.random() < 0.50005) else False)
        self.is_married = (True if (random.random() < 0.6) else False)
        self.get_job()
        self.address = random.choice(Town_layout.residential_locations)
        self.mode = ('car' if (random.random() < 0.8) else 'walk')
        self.passengers = list()
        if self.is_married:
            attrs = dict()
            attrs['sex'] = (not self.is_male)
            attrs['is_married'] = True
            attrs['spouse'] = self
            attrs['address'] = self.address
            self.spouse = Person(city, attrs)
            child_count = random.randint(0, 3)
            if child_count:
                attrs = dict()
                if self.is_male:
                    attrs['father'] = self
                    attrs['mother'] = self.spouse
                else:
                    attrs['mother'] = self
                    attrs['father'] = self.spouse
                attrs['address'] = self.address
                child = Person(city, attrs)
                self.add_child(child)
                self.spouse.add_child(child)
    elif ('spouse' in attrs):
        self.is_male = attrs['sex']
        self.is_married = attrs['is_married']
        self.spouse = attrs['spouse']
        self.address = attrs['address']
        if (random.random() < 0.9):
            self.get_job()
        self.mode = ('car' if (random.random() < 0.8) else 'walk')
        self.passengers = list()
    else:
        self.father = attrs['father']
        self.mother = attrs['mother']
        self.address = attrs['address']
        self.is_student = (True if (random.randint(1, 18) > 7) else False)
        if self.is_student:
            self.school = random.choice(Registrar_of_companies.schools)
            self.school.add_student(self)
            self.mode = 'walk'
def __init__(self, city, attrs=None):
    self.name = ('Person_%04d' % len(city.residents))
    city.residents.append(self)
    self.children = list()
    self.father = None
    self.mother = None
    self.spouse = None
    self.company = None
    if (not attrs):
        self.is_male = (True if (random.random() < 0.50005) else False)
        self.is_married = (True if (random.random() < 0.6) else False)
        self.get_job()
        self.address = random.choice(Town_layout.residential_locations)
        self.mode = ('car' if (random.random() < 0.8) else 'walk')
        self.passengers = list()
        if self.is_married:
            attrs = dict()
            attrs['sex'] = (not self.is_male)
            attrs['is_married'] = True
            attrs['spouse'] = self
            attrs['address'] = self.address
            self.spouse = Person(city, attrs)
            child_count = random.randint(0, 3)
            if child_count:
                attrs = dict()
                if self.is_male:
                    attrs['father'] = self
                    attrs['mother'] = self.spouse
                else:
                    attrs['mother'] = self
                    attrs['father'] = self.spouse
                attrs['address'] = self.address
                child = Person(city, attrs)
                self.add_child(child)
                self.spouse.add_child(child)
    elif ('spouse' in attrs):
        self.is_male = attrs['sex']
        self.is_married = attrs['is_married']
        self.spouse = attrs['spouse']
        self.address = attrs['address']
        if (random.random() < 0.9):
            self.get_job()
        self.mode = ('car' if (random.random() < 0.8) else 'walk')
        self.passengers = list()
    else:
        self.father = attrs['father']
        self.mother = attrs['mother']
        self.address = attrs['address']
        self.is_student = (True if (random.randint(1, 18) > 7) else False)
        if self.is_student:
            self.school = random.choice(Registrar_of_companies.schools)
            self.school.add_student(self)
            self.mode = 'walk'