Class1.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace WSUniversalLib
  7. {
  8. public class Calculation
  9. {
  10. public static int GetPriorityForAgent(int agentType, float age, float experience)
  11. {
  12. float[] agentKoef = { 0, 1.8F, 3.2F, 4.1F };
  13. float[] agentKoefYoung = { 0, 1.9F, 3.37F, 4.36F };
  14. float[] agentKoef10 = { 0, 2.3F, 3.7F, 4.6F };
  15. float[] agentKoef20 = { 0, 2.5F, 3.9F, 4.8F };
  16. float[] agentKoef40 = { 0, 2.7F, 4.1F, 5.0F };
  17. int priority = 0;
  18. if (agentType <= 0 || age <= 0 || experience <= 0)
  19. {
  20. return -1;
  21. }
  22. if (age < 25 && experience < 3)
  23. {
  24. priority = Convert.ToInt32(Math.Round(experience * agentKoefYoung[agentType]));
  25. return priority;
  26. }
  27. if (experience >= 10 && experience <20)
  28. {
  29. priority = Convert.ToInt32(Math.Round(experience * agentKoef10[agentType]));
  30. return priority;
  31. }
  32. if (experience >= 20)
  33. {
  34. priority = Convert.ToInt32(Math.Round(experience * agentKoef20[agentType]));
  35. return priority;
  36. }
  37. if (experience >= 40)
  38. {
  39. priority = Convert.ToInt32(Math.Round(experience * agentKoef40[agentType]));
  40. return priority;
  41. }
  42. else
  43. {
  44. priority = Convert.ToInt32(Math.Round(experience * agentKoef[agentType]));
  45. return priority;
  46. }
  47. }
  48. }
  49. }