factory_wage.py 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. """Calculate wage"""
  2. from rival_regions_calc import Item, WorkProduction
  3. RESOURCEPRICE = 2500
  4. RESOURCE = Item("uranium")
  5. WP = WorkProduction(RESOURCE)
  6. WP.factory_level = 165
  7. WP.resource_max = 25
  8. WP.department_bonus = 6.9
  9. WP.wage_percentage = 100
  10. WP.tax_rate = 0
  11. def main():
  12. """Main function"""
  13. # WP.user_level = 30
  14. # WP.work_exp = 80000 + 200 * 30
  15. # WP.calculate()
  16. # base_wage = WP.wage() * RESOURCEPRICE
  17. base_wage = 190000000
  18. base_wage = int(round(base_wage, -len("%i" % base_wage)+2))
  19. user_bonus = 2500000
  20. education_bonus = 900000
  21. # education_bonus = int(user_bonus * 0.4)
  22. print("resource price : $ {:9}".format(RESOURCEPRICE))
  23. print("tax rate : {:9} %".format(WP.tax_rate))
  24. print("factory level : {:9}".format(WP.factory_level))
  25. print("department bonus : {:9} %".format(WP.department_bonus))
  26. print()
  27. print("base wage : $ {:9}".format(base_wage))
  28. print("user bonus : $ {:9}".format(user_bonus))
  29. print("education bonus : $ {:9}".format(education_bonus))
  30. print("LVL EDU % HOUR PROFIT WAGE")
  31. for level in range(60, 101, 5):
  32. calc_procentage(base_wage, user_bonus, education_bonus, level, (level - 30) * 14 - 350)
  33. calc_procentage(base_wage, user_bonus, education_bonus, 93, 606)
  34. calc_procentage(base_wage, user_bonus, education_bonus, 88, 491)
  35. calc_procentage(base_wage, user_bonus, education_bonus, 88, 344)
  36. print_wages(base_wage, user_bonus, education_bonus)
  37. def calc_procentage(base_wage, user_bonus, education_bonus, user_level, education_level):
  38. """Calculate procentage"""
  39. WP.user_level = user_level
  40. WP.work_exp = 80000 + 200 * education_level
  41. WP.calculate()
  42. calculated_wage = WP.wage() * RESOURCEPRICE
  43. fixed_wage = base_wage + user_level * user_bonus + education_level * education_bonus
  44. procent = 100 / calculated_wage * fixed_wage - 100
  45. hour_difference = round(calculated_wage - fixed_wage) * 180
  46. # print("fixed wage : {}".format(fixed_wage))
  47. # print("calculated wage : {}".format(calculated_wage))
  48. # print("procent : {}".format(procent))
  49. print("{:3} {:3}: {:6.2f} {:16,} {:13,}".format(
  50. user_level, education_level, procent, hour_difference, fixed_wage
  51. ).replace(',', '.'))
  52. def print_wages(base_wage, user_bonus, education_bonus):
  53. """Print wages"""
  54. print("Cash wage in kk")
  55. print("Level education")
  56. education_range = range(50, 401, 25)
  57. top_row = " "
  58. for education in education_range:
  59. top_row += ",{:>4}".format(education)
  60. print(top_row)
  61. for level in range(60, 101, 2):
  62. wage_row = "{:>5} ".format(level)
  63. for education in education_range:
  64. wage = base_wage + user_bonus * (level + 1) + education_bonus * (education+ 1)
  65. wage_row += ",{}".format(int(round(wage, -6)/1000000))
  66. print(wage_row)
  67. if __name__ == "__main__":
  68. main()