Class1.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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[] agentKoefOlder10 = { 0, 2.3F, 3.7F, 4.6F };
  15. float[] agentKoefOlder20 = { 0, 2.5F, 3.9F, 4.8F };
  16. float[] agentKoefOlder40 = { 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 * agentKoefOlder10[agentType]));
  30. return priority;
  31. }
  32. if (experience >= 20 && experience < 40)
  33. {
  34. priority = Convert.ToInt32(Math.Round(experience * agentKoefOlder20[agentType]));
  35. return priority;
  36. }
  37. if (experience >= 40)
  38. {
  39. priority = Convert.ToInt32(Math.Round(experience * agentKoefOlder40[agentType]));
  40. return priority;
  41. }
  42. else
  43. {
  44. priority = Convert.ToInt32(Math.Round(experience * agentKoef[agentType]));
  45. return priority;
  46. }
  47. }
  48. }
  49. }