xponen

OD payback suggestion

Jul 17th, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.21 KB | None | 0 0
  1. The following is for hypothetical 4 player:
  2. NOTE: "previousXXX" value (see below) can be updated every seconds OR minutes depending on desired payback period.
  3. [
  4. previousMetalOutput
  5. previousEOutput_1
  6. previousEOutput_2
  7. previousEOutput_3
  8. previousEOutput_4
  9. metalShare = previousMetalOutput/4
  10. {
  11. currentMetalOutput
  12. currentEOutput_1
  13. currentEOutput_2
  14. currentEOutput_3
  15. currentEOutput_4
  16.  
  17. metalDiff = currentMetalOutput -previousMetalOutput
  18. eDiff_1 = currentEOutput_1 -previousEOutput_1
  19. eDiff_2 = currentEOutput_2 -previousEOutput_2
  20. eDiff_3 = currentEOutput_3 -previousEOutput_3
  21. eDiff_4 = currentEOutput_4 -previousEOutput_4
  22.  
  23. totalEDiff = eDiff_1 + eDiff_2 + eDiff_3 + eDiff_4
  24. plyr1_share = eDiff_1/totalEDiff
  25. plyr2_share = eDiff_2/totalEDiff
  26. plyr3_share = eDiff_3/totalEDiff
  27. plyr4_share = eDiff_4/totalEDiff
  28.  
  29. Function_giveMetal(player_1, metalShare + plyr1_share*metalDiff)
  30. Function_giveMetal(player_2, metalShare + plyr2_share*metalDiff)
  31. Function_giveMetal(player_3, metalShare + plyr3_share*metalDiff)
  32. Function_giveMetal(player_4, metalShare + plyr4_share*metalDiff)
  33. }
  34. previousMetalOutput
  35. previousEOutput_1
  36. previousEOutput_2
  37. previousEOutput_3
  38. previousEOutput_4
  39. ]
  40.  
  41. PROOF:
  42. case A: all positive E & positive Overdrive metal output
  43. [
  44.     previousMetalOutput = 100
  45.     previousEOutput_1 = 10
  46.     previousEOutput_2 = 5
  47.     previousEOutput_3 = 6
  48.     previousEOutput_4 = 7
  49.     metalShare = previousMetalOutput/4 = 25
  50.     {
  51.     currentMetalOutput = 120
  52.     currentEOutput_1 = 11
  53.     currentEOutput_2 = 10
  54.     currentEOutput_3 = 6
  55.     currentEOutput_4 = 10
  56.  
  57.     metalDiff = 120 - 100 = 20
  58.     eDiff_1 = 11 - 10 = 1
  59.     eDiff_2 = 10 - 5 = 5
  60.     eDiff_3 = 6 - 6 = 0
  61.     eDiff_4 = 10 - 7 = 3
  62.  
  63.     totalEDiff = 1 + 5 + 0 + 3 = 9
  64.     plyr1_share = 1/9 = 0.1111
  65.     plyr2_share = 5/9 = 0.5555
  66.     plyr3_share = 0/9 = 0
  67.     plyr4_share = 3/9 = 0.3333
  68.  
  69.     Function_giveMetal(player_1, 25 + 2.222)
  70.     Function_giveMetal(player_2, 25 + 11.11)
  71.     Function_giveMetal(player_3, 25 + 0)
  72.     Function_giveMetal(player_4, 25 + 6.666)
  73.     }
  74.     CHECK:
  75.     previousMetalOutput + plyr1_share + plyr2_share + plyr3_share + plyr4_share= 25 + 2.222 + 25 + 11.11 + 25 + 0 + 25 + 6.666 = 119.998
  76.     currentMetalOutput = 120
  77.     *value matched to 2nd decimal, no missing value*
  78. ]
  79. Case B: some positive E, some deficit E, and generally positive Overdrive metal output
  80. [
  81.     previousMetalOutput = 100
  82.     previousEOutput_1 = 10
  83.     previousEOutput_2 = 5
  84.     previousEOutput_3 = 6
  85.     previousEOutput_4 = 7
  86.     metalShare = previousMetalOutput/4 = 25
  87.     {
  88.     currentMetalOutput = 120
  89.     currentEOutput_1 = 14
  90.     currentEOutput_2 = 3
  91.     currentEOutput_3 = 4
  92.     currentEOutput_4 = 10
  93.  
  94.     metalDiff = 120 - 100 = 20
  95.     eDiff_1 = 14 - 10 = 4
  96.     eDiff_2 = 3 - 5 = -2
  97.     eDiff_3 = 4 - 6 = -2
  98.     eDiff_4 = 10 - 7 = 3
  99.  
  100.     totalEDiff = 4 + -2 + -2 + 3 = 3
  101.     plyr1_share = 4/3 = 1.3333
  102.     plyr2_share = -2/3 = -0.6666
  103.     plyr3_share = -2/3 = -0.6666
  104.     plyr4_share = 3/3 = 1
  105.  
  106.     Function_giveMetal(player_1, 25 + 26.666)
  107.     Function_giveMetal(player_2, 25 + -13.332)
  108.     Function_giveMetal(player_3, 25 + -13.332)
  109.     Function_giveMetal(player_4, 25 + 20)
  110.     }
  111.     CHECK:
  112.     previousMetalOutput + plyr1_share + plyr2_share + plyr3_share + plyr4_share= 25 + 26.666 + 25 + -13.332 + 25 + -13.332 + 25 + 20 = 120.002
  113.     currentMetalOutput = 120
  114.     *value matched to 2nd decimal, no missing value*
  115. ]
  116. Case C: some positive E, some negative E, and generally negative Overdrive metal output
  117. [
  118.     previousMetalOutput = 100
  119.     previousEOutput_1 = 10
  120.     previousEOutput_2 = 5
  121.     previousEOutput_3 = 6
  122.     previousEOutput_4 = 7
  123.     metalShare = previousMetalOutput/4 = 25
  124.     {
  125.     currentMetalOutput = 80
  126.     currentEOutput_1 = 5
  127.     currentEOutput_2 = 4
  128.     currentEOutput_3 = 7
  129.     currentEOutput_4 = 8
  130.  
  131.     metalDiff = 80 - 100 = -20
  132.     eDiff_1 = 5 - 10 = -5
  133.     eDiff_2 = 4 - 5 = -1
  134.     eDiff_3 = 7 - 6 = 1
  135.     eDiff_4 = 8 - 7 = 1
  136.  
  137.     totalEDiff = -5 + -1 + 1 + 1 = -4
  138.     plyr1_share = -5/-4 = 1.25
  139.     plyr2_share = -1/-4 = 0.25
  140.     plyr3_share = 1/-4 = -0.25
  141.     plyr4_share = 1/-4 = -0.25
  142.  
  143.     Function_giveMetal(player_1, 25 + -25)
  144.     Function_giveMetal(player_2, 25 + -5)
  145.     Function_giveMetal(player_3, 25 + 5)
  146.     Function_giveMetal(player_4, 25 + 5)
  147.     }
  148.     CHECK:
  149.     previousMetalOutput + plyr1_share + plyr2_share + plyr3_share + plyr4_share= 25 + -25 + 25 + -5 + 25 + 5 + 25 + 5 = 80
  150.     currentMetalOutput = 80
  151.     *value matched, no missing value*
  152. ]
  153. Case D: all negative E, and generally negative Overdrive metal output
  154. [
  155.     previousMetalOutput = 100
  156.     previousEOutput_1 = 10
  157.     previousEOutput_2 = 5
  158.     previousEOutput_3 = 6
  159.     previousEOutput_4 = 7
  160.     metalShare = previousMetalOutput/4 = 25
  161.     {
  162.     currentMetalOutput = 80
  163.     currentEOutput_1 = 5
  164.     currentEOutput_2 = 4
  165.     currentEOutput_3 = 5
  166.     currentEOutput_4 = 6
  167.  
  168.     metalDiff = 80 - 100 = -20
  169.     eDiff_1 = 5 - 10 = -5
  170.     eDiff_2 = 4 - 5 = -1
  171.     eDiff_3 = 5 - 6 = -1
  172.     eDiff_4 = 6 - 7 = -1
  173.  
  174.     totalEDiff = -5 + -1 + -1 + -1 = -8
  175.     plyr1_share = -5/-8 = 0.625
  176.     plyr2_share = -1/-8 = 0.125
  177.     plyr3_share = -1/-8 = 0.125
  178.     plyr4_share = -1/-8 = 0.125
  179.  
  180.     Function_giveMetal(player_1, 25 + -12.5)
  181.     Function_giveMetal(player_2, 25 + -2.5)
  182.     Function_giveMetal(player_3, 25 + -2.5)
  183.     Function_giveMetal(player_4, 25 + -2.5)
  184.     }
  185.     CHECK:
  186.     previousMetalOutput + plyr1_share + plyr2_share + plyr3_share + plyr4_share= 25 + -12.5 + 25 + -2.5 + 25 + -2.5 + 25 + -2.5 = 80
  187.     currentMetalOutput = 80
  188.     *value matched, no missing value*
  189. ]
Advertisement
Add Comment
Please, Sign In to add comment