"""Calculate wage""" from rival_regions_calc import Item, WorkProduction RESOURCEPRICE = 2300 RESOURCE = Item("uranium") WP = WorkProduction(RESOURCE) WP.factory_level = 165 WP.resource_max = 25 WP.department_bonus = 6.9 WP.wage_percentage = 100 WP.tax_rate = 0 def main(): """Main function""" # WP.user_level = 30 # WP.work_exp = 80000 + 200 * 30 # WP.calculate() # base_wage = WP.wage() * RESOURCEPRICE base_wage = 160000000 base_wage = int(round(base_wage, -len("%i" % base_wage)+2)) user_bonus = 1900000 education_bonus = 800000 # education_bonus = int(user_bonus * 0.4) print("resource price : $ {:9}".format(RESOURCEPRICE)) print("tax rate : {:9} %".format(WP.tax_rate)) print("factory level : {:9}".format(WP.factory_level)) print("department bonus : {:9} %".format(WP.department_bonus)) print() print("base wage : $ {:9}".format(base_wage)) print("user bonus : $ {:9}".format(user_bonus)) print("education bonus : $ {:9}".format(education_bonus)) print("LVL EDU % HOUR PROFIT WAGE") for level in range(60, 101, 5): calc_procentage(base_wage, user_bonus, education_bonus, level, (level - 30) * 8 - 150) calc_procentage(base_wage, user_bonus, education_bonus, 93, 606) print_wages(base_wage, user_bonus, education_bonus) def calc_procentage(base_wage, user_bonus, education_bonus, user_level, education_level): """Calculate procentage""" WP.user_level = user_level WP.work_exp = 80000 + 200 * education_level WP.calculate() calculated_wage = WP.wage() * RESOURCEPRICE fixed_wage = base_wage + user_level * user_bonus + education_level * education_bonus procent = 100 / calculated_wage * fixed_wage - 100 hour_difference = round(calculated_wage - fixed_wage) * 180 # print("fixed wage : {}".format(fixed_wage)) # print("calculated wage : {}".format(calculated_wage)) # print("procent : {}".format(procent)) print("{:3} {:3}: {:6.2f} {:16,} {:12,}".format( user_level, education_level, procent, hour_difference, fixed_wage ).replace(',', '.')) def print_wages(base_wage, user_bonus, education_bonus): """Print wages""" print("Cash wage in kk") print("Level education") education_range = range(50, 401, 25) top_row = " " for education in education_range: top_row += ",{:>4}".format(education) print(top_row) for level in range(60, 101, 2): wage_row = "{:>5} ".format(level) for education in education_range: wage = base_wage + user_bonus * (level + 1) + education_bonus * (education+ 1) wage_row += ",{}".format(int(round(wage, -6)/1000000)) print(wage_row) if __name__ == "__main__": main()