def workHandler(self): self.next_day() religionList = d.getReligions() unitList = d.getUnit() businessList = d.getBusinesses() peopleList = d.getPeople() bossList = d.getBosses() localityList = d.getLocality() if self.model.week.state == 'Friday': self.model.salaryPayer.paySalaries() if self.model.week.state == 'Sunday': for person in peopleList: person.churchHandler() for religion in religionList: for business in religion.getBusinesses(): for priest in business.getPriestJobs(): priest.service() #workday if self.model.week.state != 'Sunday': for business in businessList: business.workHandler() for person in peopleList: person.workHandler() person.bossmaker() for boss in bossList: i_build = self.model.startupAI.whatToBuild(boss) self.model.builder.buildChain(boss.businesses[0], i_build)
def assignChurches(self): peopleList = d.getPeople() for person in peopleList: religion = person.getReligion() business = religion.getLocalBusiness(person.getLocality()) church = random.choice(business.getUnits()) person.unitManager(church) person.newChurch(church)
def shopHandler(self): businessList = d.getBusinesses() peopleList = d.getPeople() if self.model.week.state != 'Sunday': for business in businessList: business.shopHandler() for person in peopleList: person.shopHandler()
def makeFriends(self): peopleList = d.getPeople() for person in peopleList: for count in range(20): i = random.randrange(len(peopleList)) friend = peopleList[i] friendProfile = person.peopleManager(friend) friendProfile.updateMuList(friend.getMuList(), person.locality.getDayNum()) personProfile = friend.peopleManager(person) personProfile.updateMuList(person.getMuList(), person.locality.getDayNum())
def sleepHandler(self): peopleList = d.getPeople() businessList = d.getBusinesses() for person in peopleList: person.sleepHandler() if self.model.week.state != 'Sunday': for business in businessList: business.sleepHandler() self.model.out("\nThe day ends.\n")
def makeSpouses(self): peopleList = d.getPeople() i = 0 for index in range((len(peopleList) // 2)): wife = peopleList[i] husband = peopleList[i + 1] wife.setSpouse(husband) husband.setSpouse(wife) wife.home.removeTenant(wife) wife.setHome(husband.getHome()) wife.home.addTenant(wife) i += 2
def relaxHandler(self): bossList = d.getBosses() businessList = d.getBusinesses() peopleList = d.getPeople() if self.model.week.state != 'Sunday': for boss in bossList: for business in boss.getBusinesses(): self.model.productionAI.setProduction(business) for job in business.craftingJobs: self.model.jobPoster.managePositions(job) for business in businessList: business.restHandler() for person in peopleList: person.restHandler()
def makeChurches(self, locality): peopleList = d.getPeople() perChurch = 30 churchNum = math.floor(len(peopleList) / perChurch) religions = d.getReligions() religionNum = len(d.getReligions()) if churchNum < 1: churchNum = 1 for religion in religions: churchPer = math.ceil(churchNum / religionNum) business = religion.getLocalBusiness(locality) for i in range(churchPer): churchName = random.choice(religion.churchNames) location = locality.find_property() newChurch = u.Church(churchName, locality, location, business, religion) locality.claim_node(location, newChurch)
import orders as o import people as p import profiles as pr import unit as u from conversation import Convo from gui import gui from model import Model #main model = Model() Jonestown = d.getLocality()[0] model.week.machine.set_state('Thursday') #players MrMoney = d.getPeople()[0] MrsMoney = d.getPeople()[1] you = model.gui.char CatholicChurch = d.getChurches()[0] ProtestantChurch = d.getChurches()[1] #testbus testBus = you.startBusiness("Williamson Shipping LTD") testBus.cash = 1000000 d.addBoss(you) model.gui.mainloop() # testFarm = u.Farm("Bill's Farm", Jonestown, (23,23), testBus) # testMill = u.Mill("Bill's Mill", Jonestown, (23,25), testBus)
def makeBosses(self): peopleList = d.getPeople() for i in range(100): boss = random.choice(peopleList) if boss.capital < 1000000: boss.capital += 1000000