def updateMoneyRating(): global totalCapacity,moneyRating, mRValue totalCapacity = 0 moneyRating = 0 for i in range(len(restaurant1)): if restaurant1[i].type =='finance': totalCapacity = totalCapacity + restaurant1[i].capacity noOfPeople = len(peopleList) if len(peopleList)<totalCapacity: j = 0 while noOfPeople > 0: if restaurant1[j].type =='finance': if noOfPeople > restaurant1[j].capacity: moneyRating = moneyRating + (mRValue * restaurant1[j].capacity) noOfPeople = noOfPeople - restaurant1[j].capacity else: moneyRating = moneyRating + (mRValue * noOfPeople) noOfPeople = 0 j = j + 1 moneyRating = moneyRating / len(peopleList) #showMessage('money Rating is ' + str(moneyRating),'blue') setNeedMoneyRating(moneyRating) return moneyRating elif len(peopleList)>totalCapacity: excessPeople = len(peopleList) - totalCapacity k = 0 while totalCapacity > 0: if restaurant1[k].type =='finance': moneyRating = moneyRating + (mRValue * restaurant1[k].capacity) totalCapacity = totalCapacity - restaurant1[k].capacity k = k + 1 moneyRating = moneyRating - (mRValue * excessPeople) moneyRating = moneyRating / len(peopleList) showMessage(' The citizens don\'t have money to spend. Build industries for them to earn money.','red') setNeedMoneyRating(moneyRating) return moneyRating
def updateBoredomRating(): global totalCapacity,boredomRating,bRValue totalCapacity = 0 boredomRating = 0 for i in range(len(restaurant1)): if restaurant1[i].type =='entertainment': totalCapacity = totalCapacity + restaurant1[i].capacity noOfPeople = len(peopleList) if len(peopleList)<totalCapacity: j = 0 while noOfPeople>0: if restaurant1[j].type =='entertainment': if noOfPeople > restaurant1[j].capacity: boredomRating = boredomRating + (bRValue * restaurant1[j].capacity) noOfPeople = noOfPeople - restaurant[j].capacity else: boredomRating = boredomRating + (bRValue * noOfPeople) noOfPeople = 0 j = j + 1 boredomRating = boredomRating / len(peopleList) #showMessage('boredom Rating is ' + str(boredomRating),'blue') setBoredomRating(boredomRating) return boredomRating elif len(peopleList)>totalCapacity: excessPeople = len(peopleList) - totalCapacity k = 0 while totalCapacity > 0: if restaurant1[k].type=='entertainment': boredomRating = boredomRating + (bRValue * restaurant1[k].capacity) totalCapacity = totalCapacity - restaurant1[k].capacity k = k + 1 boredomRating = boredomRating - (bRValue * excessPeople) boredomRating = boredomRating / len(peopleList) showMessage('The citizens are getting bored. They cannot find any place to amuse. Build Cinema Halls','red') setBoredomRating(boredomRating) return boredomRating
def updateHungerRating(): global totalCapacity,hungerRating,hRValue totalCapacity = 0 hungerRating = 0 for i in range(len(restaurant1)): if restaurant1[i].type =='eating': totalCapacity = totalCapacity + restaurant1[i].capacity noOfPeople = len(peopleList) if len(peopleList)<totalCapacity: j=0 while noOfPeople >0 : if restaurant1[j].type == 'eating': if noOfPeople > restaurant1[j].capacity: hungerRating = hungerRating + (hRValue * restaurant1[j].capacity) noOfPeople = noOfPeople - restaurant1[j].capacity else : hungerRating = hungerRating + (hRValue * noOfPeople) noOfPeople = 0 j = j + 1 hungerRating = hungerRating / len(peopleList) #showMessage('hungerRating is ' + str(hungerRating),'blue') setHungerRating(hungerRating) return hungerRating elif len(peopleList)>totalCapacity: excessPeople = len(peopleList) - totalCapacity k = 0 while totalCapacity >0: if restaurant1[k].type == 'eating': hungerRating = hungerRating + (hRValue * restaurant1[k].capacity) totalCapacity = totalCapacity - restaurant1[k].capacity k = k + 1 hungerRating = hungerRating - (hRValue*excessPeople) hungerRating = hungerRating / len(peopleList) showMessage('Citizens are feeling hungry. They cannot find enough places to eat. Build Restaurants. ','red') setHungerRating(hungerRating) return hungerRating