Class1.cs 1.7 KB

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